jQuery-driven app. won't work without alert()
Posted
by webjawns.com
on Stack Overflow
See other posts from Stack Overflow
or by webjawns.com
Published on 2010-03-18T15:15:57Z
Indexed on
2010/03/18
15:21 UTC
Read the original article
Hit count: 290
I have seen a lot of articles on this, but none dealing with jQuery, so here I go... I am implementing a version of a script from http://javascript-array.com/scripts/jquery_simple_drop_down_menu/ into an existing application; however, I cannot get it to work without adding alert('msg...') as the first method within the $(document).ready() call.
This has nothing to do with load time... no matter how long I wait, the menu does not work. Add alert(), however, and it works like a charm.
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
function jsddm_open()
{ jsddm_canceltimer();
jsddm_close();
ddmenuitem = $(this).find('ul').css('visibility', 'visible');}
function jsddm_close()
{ if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}
function jsddm_timer()
{ closetimer = window.setTimeout(jsddm_close, timeout);}
function jsddm_canceltimer()
{ if(closetimer)
{ window.clearTimeout(closetimer);
closetimer = null;}}
$(document).ready(function()
{ $('#jsddm > li').bind('mouseover', jsddm_open)
$('#jsddm > li').bind('mouseout', jsddm_timer)});
document.onclick = jsddm_close;
© Stack Overflow or respective owner