tommoor/crumble

Double-clicking bubbles results in a persistent bubble and undesirable behavior

Closed this issue · 3 comments

E.g. If you double-click bubble # 1, bubbles #2 and #3 both show. Bubble #2 is no longer clickable or hoverable, and when bubble #3 is clicked, it only dismisses #2. Bubble #3 will stay around until the entire routine is over.

Just clarifying/confirming this issue. Since bubbles are triggered by each subsequent click, as many bubbles will appear as the times one clicks (until all bubbles have been displayed). That is to say, so long as there are 3 bubbles remaining, a triple click will expose three more bubbles, 4 clicks will display 4 bubbles etc etc. To resolve the issue, consider adding code that checks the display status of the previous bubble before a new one is displayed (i.e., only show the next bubble on click if the previous bubble is hidden). This might be helpful: http://stackoverflow.com/questions/178325/testing-if-something-is-hidden-with-jquery

Thanks guys, i'll look at a solution for this

Sorry for the quick & messy fork. Try this fix:

$grumble.click(function(ev){
    ev.stopImmediatePropagation();
    // jQuery dblclick event fires click event twice.
    // So, we need to check manually if click was already fired saving current timestamp.
    var lastClick = parseInt($(this).data('CrumbleLastClick'));
    if (isNaN(lastClick)){
        lastClick = 0;
    }
    if (ev.timeStamp - lastClick > 300){
        $(this).data('CrumbleLastClick', ev.timeStamp);
        $current.trigger('hide.bubble');
    }
});