I need to call the jquery.animate on a nested div. The div structure is something like this
<div id="jsPlumb_1_4" class="container">
<div id="PlanItemPL1" class="PlanItem">
<div id="window1" class="window">
</div>
</div>
</div>
I am interested in doing operations such as mousedown event, animate event on the div class window. Can somebody please let me know what selector should I write. Thanks for the help.
I’d suggest, without further specifics in the question, a generic approach:
JS Fiddle demo.
In this demonstration I’m binding the
mousedownevent to the#jsPlumb_1_4element (the event will propagate from any of its child elements), and triggering theanimate()on the containeddiv.windowelement.To make it a little more interesting, I’m adding a
mouseupevent too, so that onmousedownthediv.windowshrinks, and onmouseupit grows:JS Fiddle demo.
e.typeretrieves the event (mouseupormousedown), and thenewWidthvariable is either50%or80%depending on whether the event is equal tomousedownor not.