[英]auto scroll horizontal link jump
I want my link to animate scroll horizontally across the page to the desired "id" rather then jumping to it. 我希望我的链接使页面上的动画水平滚动到所需的“ id”,而不是跳转到它。 this is what I have so far but it doesn't seem to be working.
这是我到目前为止的内容,但似乎没有用。
HTML: 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: CSS:
body {
min-height:100%;
height:100%;
margin:0;
width:auto;
}
html {
min-height:100%;
height:100%;
overflow-y:hidden;
width:100% }
JavaScript: 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();
});
});
});
Please try use class="name" not class=name 请尝试使用class =“ name”而不是class = name
over wise this looks similar: Smooth scrolling when clicking an anchor link 在明智的情况下,这看起来类似: 单击锚点链接时平滑滚动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.