我 3 天前刚刚接触 HTML 代码,并没有学到太多东西,这可能是一个简单的修复,但标题说明了一切。我不确定如何设置页面链接,以便我可以使用平滑滚动的 jQuery 插件 localscoll.js。哦,我正在尝试将 .section2 链接到 .arrow 和 servers.png
Javascript:
<script type="text/javascript">
jQuery(function( $ ){
$.localScroll.defaults.axis = 'xy';
$.localScroll({
target: '#content',
queue:true,
duration:1000,
hash:true,
onBefore:function( e, anchor, $target ){
},
onAfter:function( anchor, settings ){
}
});
});
</script>
HTML:
<div class="section1">
<div class="menubar">
<div class="menubar fadeInUp animated">
<a href="#section2"><img class="menutext" src="images/menu_bar/servers.png"> </a>
</div>
<div class="banner wow fadeInUp animated" data-wow-delay="0.75s" />
<a href="#section2"><img class="arrow wow fadeIn animated" data-wow-delay="0.75s" src="css/banner/arrow.png"></a>
</div>
</div>
<div class="section2">
<a name="section2"></a>
</div>
</div>
CSS:
.arrow {
margin-top: 470px;
text-align: center;
}
.section2 {
background: url(section2/background.png);
background-position: center;
width: 100%;
height: 515px;
margin-bottom: 0;
position: relative;
}
最佳答案
根据 localscroll.js(和常见的 ref 链接),href 属性(#section2)应该是目标的 id。
尝试更改 ID
的 class
<div id="#section2">
<a name="section2"></a>
</div>
关于javascript - localscroll.js - 似乎无法弄清楚如何设置链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24832819/