我想要我的链接在页面上水平滚动动画滚动到所需的“ID”,而不是跳到它。这是我迄今为止的,但它似乎并没有工作。自动滚动水平链接跳转
HTML:
<div class = option1>
<a href= #point1> ➟ </a>
</div>
<div id = point1></div>
<!-- id point is not in the "body" of the link? does that matter? -->
CSS:
body {
min-height:100%;
height:100%;
margin:0;
width:auto;
}
html {
min-height:100%;
height:100%;
overflow-y:hidden;
width:100% }
的JavaScript:
$(document).ready({
$(function() {
$('ul.nav a').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollLeft: $($anchor.attr('href')).offset().left
}, 15000);
event.preventDefault();
});
});
});
检查** **过渡的CSS属性。 – FDavidov
是的我已经尝试过渡时间:5秒,但没有做任何事情 – sosro