Reputation: 15293
Hi have a onmouseenter and leave function, but i am not getting proper result from this. once i enter in to 'ul' it display properly, but when i leave the 'ul' it is calling again. how to solve this? i am using this function to make 'dropdown' purpose.
myfunction:
$('ul.select').bind("mouseenter mouseleave",function(){
$('ul.select ul').stop(1,1).slideToggle('250');
})
$('ul.select ul li').on('click', function(){
var qData = $(this).attr('data-qid');
var html = $(this).text();
$('ul.select>li').text(html).attr('data-qid',qData);
$(this).hide().siblings().show();
$('ul.select').mouseleave();
})
thanks.
Upvotes: 1
Views: 109
Reputation: 206028
$('ul.select').on("mouseenter mouseleave",function( e ){
if(e.type === 'mouseenter'){
$(this).find('ul').stop(1).slideDown('250');
}else{ // if is mouseleave // DO SOMETHING
$(this).find('ul').stop(1).slideUp('250');
}
});
Upvotes: 1