Last active
May 20, 2021 22:31
-
-
Save neilgee/b79282395ad900ac16670480737c940c to your computer and use it in GitHub Desktop.
Bricks Container Click
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
<script> | |
(function ($) { | |
$(function () { | |
clickContainer(); | |
}); | |
/* | |
* Make a whole Bricks Container clickable. | |
* There must be a link tag nested in the container element. | |
* Add the CSS class .click-container in the Container Settings CSS class value | |
* @link https://wpbeaches.com/make-a-whole-container-a-clickable-link-in-bricks-builder/ | |
*/ | |
function clickContainer() { | |
$('.click-container').css('cursor', 'pointer'); | |
$('.click-container').on('click', function (event) { | |
$(this).find('a')[0].click(); | |
}); | |
$('.click-container a').on('click', function (event) { | |
event.stopPropagation(); | |
}); | |
} | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment