Created
March 19, 2015 08:22
-
-
Save kier0/321e3dc78cd5f77e40ca to your computer and use it in GitHub Desktop.
Make any DIV a clickable link. Div must include a tag ( <a href=".."></a> )
This code will look for the first link tag inside the DIV Example below has 3 divs
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
| <?php wp_enqueue_script('jquery'); ?> | |
| <script> | |
| jQuery(document).ready(function () { | |
| jQuery(".landing-left-half").click(function(){ | |
| window.location = jQuery(this).find("a:first").attr("href"); | |
| return false; | |
| }); | |
| jQuery(".landing-top-right").click(function(){ | |
| window.location = jQuery(this).find("a:first").attr("href"); | |
| return false; | |
| }); | |
| jQuery(".landing-bottom-right").click(function(){ | |
| window.location = jQuery(this).find("a:first").attr("href"); | |
| return false; | |
| }); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment