Question

Im following the jPanelMenu documentation here: http://jpanelmenu.com/ to trying to create a side left menu.

I download the "jquery.jpanelmenu.min.js" and then, I instantiate jPanelMenu: var jPM = $.jPanelMenu();

And then I just need to "turn on" the plugin, and according to documentation we just need to:

jPM.on();

But its not working, Somebody there already tried this plugn and can give me a help?

My full code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.jpanelmenu.min.js"></script>
<script type="text/javascript">
var jPM = $.jPanelMenu();
jPM.on();
</script>
<title>Untitled Document</title>
</head>

<body>
<h2 class="menu-trigger">Menu</h2>
<div id="nav-menu">
    <ul id="menu">
        <li><a href="#">Item 1</a></li>
        <li><a href="#">Item 2</a></li>
        <li><a href="#">Item 3</a></li>
    </ul>
</div>
</body>
Was it helpful?

Solution

You need to instantiate menu, when the document is ready. Hence,

<head>
...
<script type="text/javascript">
$(function() {
    var jPM = $.jPanelMenu();
    jPM.on();
});
</script>
...
</head>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top