### waslidemenu Callback and Configuration Examples Source: https://github.com/webasyst/waslidemenu/blob/master/demo/index.html Shows how to use callback functions like 'afterSlide' and how to dynamically change configuration options such as 'slideSpeed' for the waslidemenu plugin. ```javascript $('#proglanghi').on('click', function() { $('#proglang').waSlideMenu({ afterSlide: function() { alert('Hi!'); } }); }); $('#proglangslow').on('click', function() { $('#proglang').waSlideMenu('slideSpeed', 2000); }); ``` -------------------------------- ### Basic Initialization with Selectors Source: https://github.com/webasyst/waslidemenu/blob/master/README.md Provides an example of initializing the waSlideMenu plugin with custom selectors for menu containers and items. This allows the plugin to correctly identify and operate on the desired HTML structure. ```html ``` -------------------------------- ### Chaining Options and Callbacks Source: https://github.com/webasyst/waslidemenu/blob/master/README.md Demonstrates how to chain multiple calls to waSlideMenu to set additional options and callbacks after the initial setup. This allows for dynamic configuration and adding behavior like slide speed and custom slide completion alerts. ```javascript var slidemenu = $"#menu".waSlideMenu({}); slidemenu.waSlideMenu({ slideSpeed : 3000, // veeeeeeeery smooooooth afterSlide : function(){ alert('Yeah!!11 This was coooool smoooth sliiide!'); } }); ``` -------------------------------- ### Initialize with afterLoadDone Callback Source: https://github.com/webasyst/waslidemenu/blob/master/README.md Demonstrates initializing the waSlideMenu plugin with a callback function that executes upon successful content loading. This is useful for performing actions after a resource has been fetched and displayed. ```javascript $"#menu".waSlideMenu({ afterLoadDone : function(){ alert('Nice URL! 200 OK!'); } }); ``` -------------------------------- ### Initialize with afterLoadFail Callback Source: https://github.com/webasyst/waslidemenu/blob/master/README.md Shows how to initialize the waSlideMenu plugin and specify a callback function to be executed when a content loading operation fails. This allows for handling errors or informing the user about failed requests. ```javascript $"#menu".waSlideMenu({ afterLoadFail : function(){ alert('Bad URL :('); } }); ``` -------------------------------- ### Initialize waslidemenu with Options Source: https://github.com/webasyst/waslidemenu/blob/master/demo/index.html Initializes the waslidemenu plugin on a selected element with custom configuration options. It ensures jQuery is loaded before execution. ```javascript window.jQuery || document.write(' ``` -------------------------------- ### waslidemenu with Custom Selectors Source: https://github.com/webasyst/waslidemenu/blob/master/demo/index.html Initializes the waslidemenu plugin with custom selectors for the menu container and list items, allowing for more flexible DOM structures. ```javascript $('#learnjava').waSlideMenu({ slideSpeed: 100, backOnTop: true, menuSelector: '.tocul', itemSelector: '.tocli' }); ``` -------------------------------- ### waSlideMenu Callback Functions Source: https://github.com/webasyst/waslidemenu/blob/master/README.md Details the available callback functions for the waSlideMenu plugin, allowing custom logic to be executed at various stages of the menu's lifecycle, such as initialization, sliding, content loading, and item clicks. ```APIDOC waSlideMenu Callbacks: onInit: Function Description: Executes after the plugin has been fully initialized. Context: Plugin instance ('this'). Example: $('#menu').waSlideMenu({ onInit : function(){ alert('Here I am!'); } }); onSlideForward: Function Description: Executes after sliding to a child submenu. Context: Plugin instance ('this'). Example: $('#menu').waSlideMenu({ onSlideForward : function(){ alert('I slide forward (deeper)!'); } }); onSlideBack: Function Description: Executes after sliding back to a parent menu. Context: Plugin instance ('this'). Example: $('#menu').waSlideMenu({ onSlideBack : function(){ alert('I slide back (bubling)!'); } }); afterSlide: Function Description: Executes after any slide animation is completed. Context: Plugin instance ('this'). Example: $('#menu').waSlideMenu({ afterSlide : function(){ alert('Yep! I just slide!!'); } }); onLatestClick: Function Description: Executes when the last node element (a menu item without a submenu) is clicked. Context: The clicked menu item element. Example: $('#menu').waSlideMenu({ onLatestClick : function(){ alert('Last element clicked: ' + $(this).text()); } }); beforeLoad: Function Description: Executes just before content is loaded from a menu item's URL. Context: jQuery object of the loadContainer. Example: $('#menu').waSlideMenu({ beforeLoad : function(){ this.html(''); } }); afterLoadAlways: Function Description: Executes after a URL content load operation has completed, regardless of success or failure. Context: Not explicitly defined, but typically related to the load operation. Example: $('#menu').waSlideMenu({ afterLoadAlways : function(){ alert('You URL request just completed!'); } }); ``` -------------------------------- ### Prepare HTML Structure for waSlideMenu Source: https://github.com/webasyst/waslidemenu/blob/master/README.md Shows the required nested unordered list (