Last active
July 4, 2018 13:07
-
-
Save maycomayco/5b23f5b438b0424d4f2fbdcf27b05ff7 to your computer and use it in GitHub Desktop.
Helper que permite hacer linkeable un <div> a la URL que tiene seteada el primer elemento <a> dentro de él.
This file contains 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
<div class="box"> | |
<h2>Box Title</h2> | |
<p>The Quick Brown Fox Jumped Over The Lazy Dog</p> | |
<p><a class="divLink" href="http://www.labnol.org/">Webpage URL</a></p> | |
</div> | |
<script> | |
jQuery(document).ready(function () { | |
// Or use this to Open link in same window (similar to target=_blank) | |
jQuery(".box").click(function(){ | |
window.location = jQuery(this).find("a:first").attr("href"); | |
return false; | |
}); | |
// Show URL on Mouse Hover | |
jQuery(".box").hover(function () { | |
window.status = jQuery(this).find("a:first").attr("href"); | |
}, function () { | |
window.status = ""; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment