Created
May 6, 2015 09:27
-
-
Save opi/8750eba32e4a02efa752 to your computer and use it in GitHub Desktop.
enlarge your click
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
| // From https://github.com/opi/basement/blob/7.x-1.x/js/basement.js#L29 | |
| // Enlarge Your Click Zone : allow link'parent element to be clickable too | |
| var enlargeYourClick = function(selector){ | |
| $(selector).click(function(e){ | |
| // don't handle if user click on a link, or if he click with mouse wheel | |
| if (e.target.tagName != "A" && e.button != 1) { | |
| var firstLink = $(this).find('a:first'), | |
| dest = firstLink.attr('href'), | |
| blank = firstLink.attr('target'); | |
| if (dest && !blank) { | |
| window.location = dest | |
| }else if (blank){ | |
| window.open(dest); | |
| }; | |
| } | |
| }) | |
| .css({cursor: 'pointer'}); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment