influxweb
3/16/2015 - 9:16 AM

Fake links in jQuery, useful for making whole elements clickable while the actual <a> is smaller inside.

Fake links in jQuery, useful for making whole elements clickable while the actual is smaller inside.

$(document).on('click', '[data-href]', function(e)
{
    var t = e.target;
    if (t && t.nodeType === 1 && t.nodeName.toLowerCase() === 'a') {
        return;
    }
    window.location.href = $(e.currentTarget).data('href');
});