Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Defer Click Fix #30

Closed
azoff opened this Issue · 0 comments

1 participant

@azoff
Owner

Hi Azoff,

first of all, great work on this. I have had an issue with the click event handling, though. I was able to solve it, so I wanted to share for future releases. Here goes:

deferClick: function(target) {
    var events = target.data('events');
    if (events && events.click && events.click.length) {
        events = events.click.slice();
        target.unbind('click').one('click',
        function(event) {
            event.preventDefault(); - >event.stopPropagation(); - >event.stopImmediatePropagation();
            $.each(events,
            function(i, event) {
                target.click(event);
            });
        }); - >
    } else { - >target.one('click',
        function(event) { - >event.preventDefault(); - >event.stopPropagation(); - >event.stopImmediatePropagation(); - >
        }); - >
    }
},

I marked all new lines with -> arrows. To explain: I am using your script in combination with jqGrid. It allows you to select rows by clicking. The click event however is not on the dragging element (e.g. the ) but on the parent (). The previous code would only prevent click events for the element itself and reattach any previously detached click events. My extension always defers the click event, and stops propagation, so the click event won't be fired on parent elements.

Hope this helps.

@azoff azoff closed this issue from a commit
Jonathan Azoff fixed click deferrence on scrolltargets. Closes #30 817f785
@azoff azoff closed this in 817f785
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.