I am trying to close the UL, using slide up. I am able to filter out the element i want to slide down, and i am trying to pass that to a function and use it as a means to pass the slideUp targeted selector. Uncaught TypeError: Object # has no method ‘slideToggle’
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
function jsddm_open(){
current_element = $(this).find('#menudropdown > li ul');
jsddm_canceltimer();
jsddm_close(current_element);
$('ul', this).slideDown();
}
function jsddm_close(current_element)
{
//alert(current_element);
current_element.slideUp();
}
function jsddm_timer(){
// var current_element = $(this);
closetimer = window.setTimeout(jsddm_close(current_element), timeout);
// current_element.slideUp();
}
function jsddm_canceltimer()
{ if(closetimer)
{ window.clearTimeout(closetimer);
closetimer = null;}}
$(document).ready(function(){
$('#menudropdown > li').bind('mouseover', jsddm_open)
$('#menudropdown > li').bind('mouseout', jsddm_timer)
});
I don’t see anything glaring as to why this might not be working, except for
current_elementseems to be an implied global. If for some reason this wasn’t set properly, this would be undefined, causing your problem. Does changing your functions to pass around the element instead of relying on globals help with the problem?