jQWidgets Forums
Forum Replies Created
-
Author
-
March 18, 2013 at 6:27 pm in reply to: Can Menu load template into include? Can Menu load template into include? #17326
Hey that’s great Dimitar thanks!
I’m now looking at ways to manage my pages better so that I don’t have all these menu list items in my main page. To that end I’m looking at having the menu context loaded from a separate file. I was thinking of the .load ability and am trying to get something like this to work:
MenuFile.html:
<div id='navigation'> <ul> <li>1 <ul> <li> <a href="room1-1.html">1.1</a></li> <li> <a href="room1-2.html">1.2</a></li> </ul> </li> <li>2</li> <li>3 <ul> <li> <a href="room3-1.html">3.1</a></li> </ul> </li> </ul></div>
Then within main page have script:
main.html:
$(function() {
$(“#navigation”).load(“MenuFile.html”);
});$(document).ready(function () {
// Create a jqxMenu$(“#navigation”).jqxMenu({ width: ‘120’, mode: ‘vertical’ });
$(‘#navigation’).on(‘itemclick’, function (event) {
event.preventDefault();
var page_url=$(this).prop(‘href’);
$(‘#content’).load(page_url);
});
});Obviously it’s not working. Questions:
1) With the jqxmenu widget do I need to use switch and case to get menu item clicked?
2) Can I put the content of the html referenced by the menu into a Div? like Div id=”Content” instead of iFrame?
3) Can I load the contents of the menu from a separate file like MenuFile.html and do I need to load it within a separate script like my example or can I call the contents into jqxmenu within the exist $(document).ready function?Thanks again for your help.
-
AuthorPosts