Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bricks Container Click
<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