I have the following jquery which opens and close the div "shopping_cart" when hover on "shopping_button"
$('#shopping_button, .shopping_cart').on('mouseenter',function(){
$(this).css('z-index','300');
$(this).css('visibility','visible');
})
$('#shopping_button, .shopping_cart').on('mouseleave',function(){
$(this).css('z-index','189');
$(this).css('visibility','hidden');
$(this).css('opacity','0');
});
Need help with what I'm trying to achieve is that "shopping_cart" remain open on mouseleave and only close on if click outside the "shopping_cart" div or can add close button inside the "shopping_cart" div to close it.
Thanks guys.
Edited
I added the following to above code
$('html').click(function () {
$('.shopping_cart').css('visibility','hidden');
});
and it does the job, only close the window when click outside "shopping_cart" div, but now if again hover on "shopping_button" it won't open the "shopping_cart" div, on inspect element it shows
$('#shopping_button, .shopping_cart').on('mouseenter',function(){
$(this).css('z-index','300');
$(this).css('visibility','visible'); <---This Remain Hidden
})
Any Suggestion?
sorted
added this into mouseenter funtion
$('.shopping_cart').css('visibility','visible');
And vollhhaaaa....:D
Still looking for more clean solution, if anybody have....
Thanks for all the help.