Web Development Blog

Make Dropit jQuery Dropdowns Close on MouseOut

I’ve recently stumbled upon Dropit dropdowns plugin for jQuery. It’s a great, simple dropdown script that you can quickly implement. But I’ve found it was missing one thing. How to make Dropit jQuery dropdowns close on mouseout. So I’ve created a little script that makes the dropdown close when you mouse out or hover off the menu and sub menus. Just add the following in your dropit.js file right before the commented line “// Close if outside click“.

Code to Add:

// Close if mouse outside
$el.mouseleave(function() {
settings.beforeHide.call(this);
$('.dropit-open').removeClass('dropit-open').find('.dropit-submenu').hide();
settings.afterHide.call(this);
});

Download dropit.js with changes

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Request A Free Quote

GET OUR PRICING GUIDE

Enter your email address below, and we'll send you our current pricing guide immediately.