2013-11-14 58 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

固定它。我已将第一个链接导航到首页,因此当您按下该页面时,页面会刷新。导致脚本不能运行:)