Created
February 11, 2013 15:46
-
-
Save Gerhard-Kanzler/4755235 to your computer and use it in GitHub Desktop.
Click on every <div> or Something and go To a hidden Link (eg. First Link in <div>)
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
| function goToLink( selektor ){ | |
| function isClickable( obj ){ | |
| var $this = obj, | |
| link = $this.find('a:first'), | |
| href = link.attr('href'), | |
| target = link.attr('target'); | |
| if( target == '_blank' ){ | |
| window.open( href ); | |
| }else{ | |
| window.location.href = href; | |
| } | |
| } | |
| $(selektor).find('a:first').on('click', function(){ | |
| isClickable( $(this).parents( selektor + ':first' ) ); | |
| return false; | |
| }); | |
| $(selektor).on('click', function(){ | |
| isClickable( $(this) ); | |
| }); | |
| } | |
| //Edit here the Selector if you need | |
| goToLink( '.isClickable' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment