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

Possible for child element to trigger parent animation #6

Closed mtwallet closed 13 years ago

mtwallet commented 13 years ago

I have an unordered list like this:

<ul id="container">
<li class="active">Text</li>
<li class="next">Text</li>
<li>Text</li>
<li>Text</li>
</ul>

Is it possible to use approach to make the li.next trigger an animation on the ul#container in anyway? so something like this:

$('.next').approach({ $('#container').animate({ left : '-200px'}); });

Many Thanks.

srobbin commented 13 years ago

Hi mtwallet,

That's a little outside the realm of what approach does, though I imagine you might be able to hack approach into doing this for you. The only issue I see is that the closer you get to next, the further it slides from your mouse (since container is moving). This might cause "container" to slip further and further from your grasp.

Best of luck, Scott