samedi 25 juin 2016

Using offset(); coordinates to trigger fadeOut();

You can tell by my rep that I'm a super novice, apologies if this seems simple to you.

I've got a model solar system spinning around in HTML and CSS. I've cobbled some JS in there to make the planets play some music and fadeOut() on hover()

However, I want to remove the hover() and make the planets do their thing based on their coordinates; each of them playing a note when they hit a certain coordinate.

I've tried this:

$(document).ready(function() {
    var x = $("#mercury").offset;
if(x.top >= 1200.00 && x.left >=1000.00){
    $("#mercury").fadeOut("slow");

};

But, nothing happens.

I'm sure this is an issue of my own ignorance, I'm probably writing this incorrectly but, I need help.

In short, how do I trigger an event based on offset() coordinates?

Aucun commentaire:

Enregistrer un commentaire