clickMenu update -> 0.1.2

Another update for the jQuery plugin. It’s got a LOT better (and if not, than at least faster!).

Please take a look at the demo.

Files: (new version here)

Example:

<script type="text/javascript">
$(document).ready(function()
{
    $.fn.clickMenu.setDefaults({arrowSrc:'arrow_right.gif', onClick: function(){/*do something*/}});
    $('selector1').clickMenu(); /* use default values */
    $('selector2').clickMenu({arrowSrc:''}); /* dont use an arrow for submenus */
    $('selector3').clickMenu({fadeTime: 2000, subDelay: 1000, mainDelay: 500}); /* slow menu */
});
</script>

Available options:

  • onClick - function - callback function triggered when a list item is clicked
  • arrowSrc - string - url of the image to be used as an arrow indicating a submenu (e.g. “images/somearrow.jpg” or an empty string if you don’t want an arrow)
  • mainDelay - string or number - the time to wait before starting the fadein after hovering over a main menu item (”slow”, “normal” or “fast” or the time in milliseconds - e.g. 1000)
  • subDelay - string or number - the time to wait before starting the fadein after hovering submenu item (”slow”, “normal” or “fast” or the time in milliseconds - e.g. 1000)
  • fadeTime - string or number - the speed at which the fadein/fadeout animation runs (”slow”, “normal” or “fast” or the time in milliseconds - e.g. 1000)

Changelog:

  • change: made a lot changes in the traversing routines to speed things up (having better memory usage now as well)
  • change: added $.fn.clickMenu.setDefaults() for setting global defaults
  • fix: hoverbug when a main menu item had no submenu
  • fix: some bugs i found while rewriting most of the stuff
  • change: renamed file to jquery.clickmenu.js

Known problems:

  • memory usage’s gotten better, but is still far from perfect
  • the css-defined min-width is not working on ie, what may make the submenus really narrow

3 Responses to “clickMenu update -> 0.1.2”

  1. Regarding the minimum width glitch in ie, maybe you could do something like this:

    var ieLiWitdh = $('.innerBox li').width();
    if(ieLiWitdh

  2. The code in my previous post seemed to get cut off, this is what I posted: http://www.shorttext.com/f7wfv4

  3. Thanks for the code Yansky, I’ll try that.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Syntax Highlighting: You can use [js] .. [/js] and [html] .. [/html] for posting code snippets.