Skip to content

Instantly share code, notes, and snippets.

@jtwalters
Last active August 29, 2015 14:15
Show Gist options
  • Save jtwalters/3ae787bf99d31e80e85e to your computer and use it in GitHub Desktop.
Save jtwalters/3ae787bf99d31e80e85e to your computer and use it in GitHub Desktop.
Make the click regions big.
$(function initLargeClickRegions() {
// Make the entire views row clickable to the first link element within the row.
$('.views-row').each(function () {
var $link = $(this).find('a:first');
if ($link.length) {
$(this).css('cursor', 'pointer');
$(this).on('click.expanded', function (e) {
// Only if a simple primary mouse button click (no ctrl/meta key
// pressed) and not a link (or child of link)
if (!e.ctrlKey && !e.metaKey && e.which === 1 &&
e.target.tagName !== 'A' && !$(e.target).parents('a').length) {
$(this).off('click.expanded');
$link[0].click();
$(this).on('click.expanded');
}
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment