Jquery.on () doesn't seem to work

I am working on orbit simulations, and I'm just trying to add a bit of user interaction to the mouseenter and mouseexit events. You can see a working example here .

My operator on:

$('.planet').on({
    'mouseenter': function() {
        pauseAnimation = true;
    },
    'mouseleave': function () {
        pauseAnimation = false;
    },
    'click' : function () {
        alert('click');
    }
});

but none of the events seem to work. If that matters, I use the latest Chrome on Mac.

+3
source share
1 answer

This is a z-index problem. Add z-index: 1;to the .planetcss section . After that, Fiddle worked fine: http://jsfiddle.net/Pe87m/9/

+5
source

All Articles