我想要我的鏈接在頁面上水平滾動動畫滾動到所需的「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