左滚动Javascript
我有一个水平滚动页面,有30多个图像。滚动页面时,在滚动动画上显示一些滞后。是否有向左滚动功能的替代方案 Javascript:左滚动Javascript,javascript,html,scroll,Javascript,Html,Scroll,我有一个水平滚动页面,有30多个图像。滚动页面时,在滚动动画上显示一些滞后。是否有向左滚动功能的替代方案 Javascript: $('.arrow').click(function(){ var $anchor = $(this); $('body, html').animate({ scrollLeft: $($anchor.attr('href') ).offset().left},500);
$('.arrow').click(function(){
var $anchor = $(this);
$('body, html').animate({
scrollLeft: $($anchor.attr('href') ).offset().left},500);
return false;
});
试一试,不返回错误
$('.arrow').click(function(){
var $anchor = $(this);
$('body, html').animate({
scrollLeft: $(this).offset().width}, 500,
function(){
// do something after animation complete.
}
});