srobbin / jquery-approach

A jQuery plugin that allows you to animate style properties based on the cursor’s proximity to an object.
http://srobbin.com/jquery-plugins/jquery-approach/
GNU General Public License v2.0
167 stars 20 forks source link

What about a special event "mouseapproach" #3

Closed LeMisterV closed 14 years ago

LeMisterV commented 14 years ago

Hi,

Do you know about jQuery "special events" ? Your idea of a mouse approach plugin is very good. Why not making an event of it ?

Here is an article describing how to define special events. I'm sure you could use it for your mouse approach idea. http://brandonaaron.net/blog/2009/03/26/special-events

It would be great to be able to do something like : $('mySelector').bind('mouseapproach', function() {alert('Don't go there !!');});

Regards,

Nico

srobbin commented 14 years ago

This is a good idea. I had considered using something along those lines, but I couldn't find a natural way to set the approach boundary. i.e. Only activate the approach animation within 300px of the object. So, I chose to treat it as a regular plugin.

Thanks for the feedback.

-Scott

LeMisterV commented 14 years ago

Hi,

I just created a new jquery plugin that implements two special events : "mouseapproach" and "mouseretreat".

As your plugin does more than just reporting that mouse approaches of retreats, I didn't create a fork, but a new repository. But your script could probably benefit from mine.

the gitHub repository for my plugin : http://github.com/LeMisterV/jquery-distanceListener

There's no comments or doc for my script, I had no time for this. But I'll try to write some soon. But I created a demo file, so you can see a use example.

Regards,

Nico