当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - localscroll.js - Can not seem to figure out how to set up the links

问题描述:

I have only just been introduced to HTML code 3 days ago and have not learnt much and this would probably be an easy fix but the title says it all. I am unsure on how to set up the page links so I can use the smooth scrolling jQuery plugin, localscoll.js. Oh and im trying to link .section2 to .arrow and 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;

}

网友答案:

According to localscroll.js (and the common ref links), the href attribute (#section2) should be the target's id.

Try change the class for ID

<div id="#section2">
    <a name="section2"></a>
</div>
分享给朋友:
您可能感兴趣的文章:
随机阅读: