2013-11-14 171 views
0

當用戶點擊我不同的導航鏈接時,我試圖通過將內容滑出頁面來改變頁面內容。到目前爲止,我可以從我的主頁滑動到我的其他頁面中的一個正常工作。但我不知道如何能夠回到第一頁。JQuery UI菜單幻燈片

腳本,我使用滑動至第一頁:

 <script> 
      function slide(div) 
      { 
       if(div == "work") 
       { 
        $('#home').hide('slide', {direction: 'left'}, 1000); 
        $('#work').delay(600).show('slide', {direction: 'right'}, 1000); 
       } 
      } 
     </script> 

內容,即時通訊與我的導航菜單沿滑動:

 <div class='nav'> 
      <table class='nav'> 
       <tr> 
        <td width='23%'><a href='index.html' onclick='slide("home");' class='link'>home</a></td> 
        <td width='23%'><a href='#' onclick='slide("work");' class='link'>work</a></td> 
        <td width='23%'><a href='#' class='link'>about</a></td> 
        <td width='31%'><a href='#' class='link'>contact</a></td> 
       </tr> 
      </table> 
     </div> 
     <div class='content' id='home'> 
      <h1>hello</h1> 
      <table class='content'> 
       <tr> 
        <td><img src='images/icon1.png' class='icon'></td> 
        <td><p>i’m thobias nordgaard. a front and back end<br> 
        developer from denmark. i love what i do,<br> 
        hopefully you will too.<br><br> 

        Im fluid in html, css, php and improving in<br> 
        javascript, jquery and sass. if you dont know<br> 
        what these things are, all they mean is: i can<br> 
        make websites.</p></td> 
       </tr> 
      </table> 
     </div> 

     <div class='content' id='work'> 
      <h1>work</h1> 
      <table class='content'> 
       <tr> 
        <td><img src='images/icon1.png' class='icon'></td> 
        <td><p>I haven't completed any work yet :(</p></td> 
       </tr> 
      </table> 
     </div> 

回答

0

固定它。我已將第一個鏈接導航到首頁,因此當您按下該頁面時,頁面會刷新。導致腳本不能運行:)