[Solved] jQuery on second hover event


Store a counter in the data of each element and increment it on each hover, if it gets to two, do your magic:

HTML:

<div class="items">
    <div class="hover-me" data-hovercount="0"></div>
    <div class="hover-me" data-hovercount="0"></div>
    <div class="hover-me" data-hovercount="0"></div>
</div>

JS:

$(".hover-me").on('mouseenter', function() {
    var $this = $(this), $this.data('hovercount', parseInt($this.data('hovercount')) + 1);
    if ($this.data('hovercount') == 2) {
        //do something.
    }
});

3

solved jQuery on second hover event