The use of the variable mouse_is_inside is not needed at all in this example (unless you do other things with it in other functions its best to remove it altogether as its less efficient and it only clutters the code) in any-case don't use it in your example just call another function in the following way
$(document).ready(function(){
$('.basket_details, .advanced_search_panel, .producers_major_panel').hover(function () {
/*add the mouse_is_inside=false; here if you need it for other functionality but dont use it for hide your panels*/
fold(); /*calling this function works just like your example but it fixes the problem and makes you use 1 less variable which is better*/
});
function fold(){
$("body").mouseup(function () {
$('.advanced_search_panel, .producers_major_panel').fadeOut('slow');
$('.basket_details').slideUp('slow');
});
}
});
you can also achieve the same functionality using click because you have to hover over an element before you click it. (there might be times where this is not true if other function calls click etc, but hopefully in your example it will still do the job)
$('.basket_details, .advanced_search_panel, .producers_major_panel').click(function(){
$('.advanced_search_panel, .producers_major_panel').fadeOut('slow');
$('.basket_details').slideUp('slow');
});
Gl Łukasz,
Niech Moc będzie z tobą
mouse_is_insideabove? withvar mouse_is_inside;statement?