Javascript 滚动固定位置=jQuery Jank,带safari中的偏移顶部

Javascript 滚动固定位置=jQuery Jank,带safari中的偏移顶部,javascript,jquery,html,css,safari,Javascript,Jquery,Html,Css,Safari,我试图让两组类在jQuery中有固定的位置 $(window).scroll(function(){ $(".staticTextGrid").each(function(){ $(this).css('margin-top',($(window).scrollTop() - $(this).parent().offset().top+160)); }); $(".staticTextGridTop").each(function(){

我试图让两组类在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中玩得很好(导致它发出刺耳的声音和抖动)。任何方向正确的点都很好。我提前表示感谢。

你没有说safari正在做的事情不好,所以我只能尝试一下。但有时safari不会在css更改后再次呈现页面。尝试将其添加到函数末尾。这不是最好的解决方案,但至少会证实问题的存在!:)


嘿,谢谢你的回复,很抱歉不清楚。这会在狩猎中引起刺耳的感觉。其他浏览器中不存在的神经质口吃。我试了一下你的建议,但还是很紧张。任何其他的尝试都会很好。谢谢。好的,在safari或IE中查看这把小提琴,它显示了抖动。任何帮助都会很好。和道具,为我提供了一个基地。
$("body").addClass("tempClass").removeClass("tempClass");