Justin808
Justin808

Reputation: 21512

jquery .on() doesn't seem to be working

I'm working on an orbit simulation and I'm just trying to add a little user interaction to th mouseenter and mouseexit events. You can see a working example here.

My on statement is:

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

but none of the events seem to be triggered. If it matters, I'm using the latest Chrome on a mac.

Upvotes: 3

Views: 85

Answers (1)

x1a4
x1a4

Reputation: 19485

It's a z-index issue. Add z-index: 1; to the .planet css section. Fiddle worked fine after that: http://jsfiddle.net/Pe87m/9/

Upvotes: 5

Related Questions