2013-06-27 37 views
1

我一直在使用一個名爲SlidePanel的jquery插件的問題。這是一個看起來很棒的滑出式菜單,但我無法讓它起作用。說明似乎有點稀疏,我不確定是否我做錯了,或者它不工作。Slidepanel jquery菜單

SlidePanel - http://codebomber.com/jquery/slidepanel/

<!DOCTYPE HTML> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <title>iON | Home</title> 
     <link rel="stylesheet" type="text/css" href="/css/web.css" /> 
     <link rel="stylesheet" type="text/css" href="/css/fonts.css" /> 
     <link rel="stylesheet" type="text/css" href="/css/jquery.slidepanel.css"> 
     <script type="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 
     <script type="text/javascript" src="/js/jquery.slidepanel.js"></script> 


    </head> 
<body> 
    <nav> 
     <ul> 
     <li><a id="title" href="index.php">iON»</a></li> 
     <li style="float: right;"><a id="menu" href="#"><img src="/images/menu.png" height="20" width="20" /></a> 
      <ul> 
       <li><a href="profile.php">Profile</a></li> 
       <li><a href="login.php">Login</a></li> 
      </ul> 
     </li> 
     </ul> 
    </nav> 

<div class="content"> 
<a href="index.php" data-slidepanel="panel">Show Panel</a> 
</div> 

<script type="text/javascript"> 
     $(document).ready(function(){ 
      $('[data-slidepanel]').slidepanel({ 
       orientation: 'top', 
       mode: 'push' 
      }); 
     }); 
</script> 

</body> 
</html> 

回答

1

你的選擇是壞的。只需添加一個類並使其變得簡單。

<a href="index.php" class='slidepanel' data-slidepanel="panel">Show Panel</a> 


$(".slidepanel").slidepanel({ 
    orientation: 'top', 
    mode: 'push' 
}); 

或者

$("[data-slidepanel='panel']").slidepanel({ 
    orientation: 'top', 
    mode: 'push' 
}); 

工作小提琴:http://jsfiddle.net/ncapito/8TEjx/

+0

我有更多的一個問題。菜單本身工作正常,但是當我打開面板時,它滑走了我的固定導航欄。這就是我用來打開菜單的按鈕。如果我用另一個按鈕觸發面板,它會消失,但我的導航欄不會恢復正常。 – CaptainXD