我试图让两组类在jQuery中拥有固定的位置。
$(window).scroll(function(){
$(".staticTextGrid").each(function(){
$(this).css('margin-top',($(window).scrollTop() - $(this).parent().offset().top+160));
});
$(".staticTextGridTop").each(function(){
$(this).css('margin-top',($(window).scrollTop() - $(this).parent().offset().top));
});
});
这就是我正在做的事情,但它并不想在safari中发挥出色(导致它变得混乱和抖动)。朝着正确方向的任何一点都会很棒。我提前感谢。
答案 0 :(得分:0)
你还没有说过safari正在做什么不好玩,所以我只能捅它。但有时候safari不会在css更改时再次呈现页面。尝试将此添加到您的功能的末尾。这不是最好的解决方案,但它至少会证实这个问题! :)
$("body").addClass("tempClass").removeClass("tempClass");