Created
August 28, 2019 08:08
-
-
Save wickywills/90460b97cd99d1214caf188b546c3e00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allow a popup type element to be closed on body click. Also plays nice on iOS. | |
``` | |
jQuery(document).on('click touchstart',function(e){ | |
$miniCart = jQuery('.mini-cart'); | |
if(!$miniCart.is(e.target) && $miniCart.has(e.target).length === 0) | |
$miniCart.hide(); | |
}); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment