April 1, 201214 yr Hi wondered if someone could help me, i have a Mega Menu i am building and on the menu i want to have it so when hover over the menu it stays open until you click outside of that div but everytime i move over it, it closes. The website url is: http://www.bluegeeks.co.uk/restaurant/index.html the one i want it on is the item name: "Menu" And the Jquery Code i have done for thi at the moment is: <script type="text/javascript"> $(document).ready(function() { $(".drop").hover(function() { $(".dropdown_3columns").show(); }); $(".drop").click(function() { $(".dropdown_3columns").hide(); }); }); </script> Kind Regards, Aaron
April 7, 201214 yr Hi Aaron, I'm no expert in jQuery (hence my other questions about jQuery on the forum!), but for this particular dropdown, you might be better off modifying the CSS class instead. This way, you could do something like this: <script type="text/javascript"> $(document).ready(function() { $(".drop").hover(function() { $(".dropdown_3columns").css("left", "-1px"); }); $(".drop").click(function() { $(".dropdown_3columns").css("left", "-999px"); }); }); </script> I think that might work, as you would be changing the CSS property, and not changing it back until it is clicked - but don't point a gun to my head if it doesn't work!!! EDIT: Also, I might be tempted to put a "close" button on your popup div, as it isn't always obvious for users that you can click outside to close - remember - assume all users are stupid!! Really must get some sleep now! Edited April 7, 201214 yr by wickywills
April 7, 201214 yr Author Thanks for reply mate, I fixed the click event I am now going to see if can do the close button and see what looks like Kind regards, Aaron Sent from ipod touch
Create an account or sign in to comment