2014-07-18 60 views
0

我剛纔剛剛介紹給HTML代碼3天前,並沒有學到太多,這可能是一個簡單的修復,但標題說這一切。我不確定如何設置頁面鏈接,因此我可以使用平滑滾動的jQuery插件localscoll.js。噢和IM試圖鏈接.section2到.arrow和servers.pnglocalscroll.js - 似乎無法弄清楚如何設置鏈接

的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; 
} 
+0

也許你可以發佈工作的jsfiddle或JSBin? –

回答

0

根據localscroll.js(和公共參考鏈接),href屬性(#section2)應該是目標的id。

嘗試改變classID

<div id="#section2"> 
    <a name="section2"></a> 
</div> 
+0

嘿,我已經嘗試了這一點,我相信你是正確的,但是,url更改爲/index.html#section2,頁面根本不滾動。 – user3854320