Skip to content

Instantly share code, notes, and snippets.

@yramagicman
Last active December 15, 2015 01:59
Show Gist options
  • Save yramagicman/5183766 to your computer and use it in GitHub Desktop.
Save yramagicman/5183766 to your computer and use it in GitHub Desktop.
add a pad around dropdown menus to compensate for mouse error
(function() { //jQuery function that adds a pad around menus
'use strict';
var x, j;
j = jQuery.noConflict();
//detect elements
var wrapPad = function(elem) {
if (j(elem).length) {
x = j(elem);
x.wrap('<div class="pad">');
j(elem).addClass('force-show');
}
};
var elems = ['nav .children', 'nav .sub-menu'];
for (var i = elems.length - 1; i >= 0; i--) {
wrapPad(elems[i]);
}
})(); // end menus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment