Jquery animate scrollLeft bug in IE and FF

孤街醉人 提交于 2019-12-01 10:31:15

问题


I trying animate a horizontal scroll, but get a litle bug in IE and FF, when click to scroll, gets a "flash" looks like a ghost of previous divs. Its hard to explain in words, see the example in http://amplabusca.org/teste2/ementa.php

Why does this happen?


回答1:


Change your click-Event to something like $('#next').click(function (event) { event.preventDefault(); // Your code... }); to prevent the "move to anchor" standard behavior.

$('#next').click(function(event) {
    event.preventDefault();
    margin +=width;
    $('html, body').stop().animate({scrollLeft:"+="+500},1000);
    $("#prev a").css('visibility','visible');
});


来源:https://stackoverflow.com/questions/5663525/jquery-animate-scrollleft-bug-in-ie-and-ff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!