2017-08-02 51 views
0

我有我的內index.html文件導航欄和我加載它在我的homePage.html文件中如下:如何使用jQuery創建一致的導航欄?

<!DOCTYPE html> 
<html> 
<head> 

<script> 
    window.$ = window.jQuery = require("jquery") 
</script> 
</head> 
<body> 

    <div id="navbar"> 

    </div> 

    <div id="page-wrapper"> 

    </div> 
</body> 


    <script> 
     $(function(){ 
      $("#navbar").load("./navbar/index.html"); 
     }); 
    </script> 
</html> 

當我把裏面的page-wrapper隨機數據因爲通過導航欄所掩蓋。

我之前和Meteor一起工作過,之前我們有一個叫{{yield}}的東西,我們用它來指示其餘的內容應該放在這裏。

它是如何在jQuery中完成的?

回答

0
<div id="page-wrapper"> 

可改爲

<div id="page-wrapper" style="margin-top:10%"> 

我相信更改CSS應該解決您的問題。