loads menu data from an HTML file and calls onLoadFunction when loading is done
object | HTMLElement | HTML data container |
clearAfterAdd | boolean | true/false, removes the container object after the data is loaded |
onLoadFunction | function | is called after the data is loaded (but before clearing HTML content, if clearAfterAdd is set to true) |
<!-- add div on the page -->
<body>
<div id="menuData" style="display: none;">
<div id="m1" text="File"> // the first top menu item
<div id="m11" text="New" <hotkey>Ctrl+N</hotkey></div>// the first child item
<div id="ms1" type="separator"></div> // a separator
<div id="m12" text="Open"><hotkey>Ctrl+O</hotkey></div> // the second child item
</div>
</div>
</body>
//init menu
<script>
menu.loadFromHTML("menuData", true, function(){});
// or
function doOnLoad(){
// your code here
}
menu.loadFromHTML("menuData", true, doOnLoad)
</script>
Back to top