我一直在使用名为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>
答案 0 :(得分: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'
});