2015-09-25 13 views
0

我有表,我上滾動X和Y軸(with JQuery)。但是當桌子滾動時,他們就像搖晃。上使用jQuery滾動事件將邊距 - 波濤洶涌/神經質/搖動運動

... 所以我的問題是:爲什麼這會發生晃動,我怎麼能防止晃動?

var leftOffset = parseInt($(".tablecontainer").css('margin-left')); 
    hhOffset = parseInt($(".headsholder").css('margin-left')); 
    fixOffset = parseInt($(".fixedphead").css('margin-left')); 
    eisastanaYOffset = parseInt($(".eisastana").css('margin-left')); 

    $(".contentbox").scroll(function(){ 
     $(".tablecontainer").css({ 
      'margin-left': $(this).scrollLeft() + leftOffset 
     }); 
     $(".tableheads").css({ 
      'margin-left': -$(this).scrollLeft() 
     }); 
     $(".headsholder").css({ 
      'margin-left': hhOffset - $(this).scrollTop() 
     }); 
     $(".fixedphead").css({ 
      'margin-left': fixOffset -$(this).scrollTop() 
     }); 
     $(".eisastana").css({ 
      'margin-left': eisastanaYOffset -$(this).scrollTop() 
     }); 
    }); 
+0

一些CSS和HTML在這裏非常有用。一個小演示(https://jsfiddle.net/)甚至更多... – Shikkediel

+1

感謝您的評論,我會盡力提供示例,只要posible,我是新手在這,所以對不起,如果sumthin :) –

回答

0

我用.stop() - Jquery.stop().animate(); - 和搖晃停止。

相關問題