Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery animate a div and when is finish, animate the second div inside the first
    primarykey
    data
    text
    <p>i have for example a header (140px height) on the web with 5 "li" content. The first 3 of this (A,B,C) open a subheader (50px height) when ".mouseover", the others 2 (D,E) close all to the begining.</p> <pre><code>jq(document).ready(function(){ jq("#A a,#B a,#C a").mouseover(function(){ jq("#subheader").animate({top:"140px"},"normal"); }); jq("#D a,#E a").mouseover(function(){ jq("#subheader").animate({top:"91px"},"normal"); }); }); </code></pre> <p>Until here all is ok, now comes the problem. Depend of which A, B or C is hovered has to do diferent things with the subheader, just at the end of the animation. (open .smenus inside subheader)</p> <pre><code> jq("#A a").mouseover(function(){ jq(".smenu1").slideDown("slow"); jq(".smenu1 ul").animate({margin:"0px auto"},"slow"); jq(".smenu1 li").animate({padding:"0 30px 0"},"slow"); }); jq("#B a").mouseover(function(){ jq(".smenu2").slideDown("slow"); jq(".smenu2 ul").animate({margin:"0px auto"},"slow"); jq(".smenu2 li").animate({padding:"0 30px 0"},"slow"); }); jq("#C a").mouseover(function(){ jq(".smenu3").slideDown("slow"); jq(".smenu3 ul").animate({margin:"0px auto"},"slow"); jq(".smenu3 li").animate({padding:"0 30px 0"},"slow"); }); </code></pre> <p>This doesn't work i think because it start loading before finishing the opening of the suheader. so i have to do this animation when the opening is finished.</p> <p>PD: And now another thing, when for example #A is hovered, and then #B, it has to stop the animation (if is not finished, or just callback), remove others submenus (in this case .smenu1) and replace it whith theirs submenu (in this case .smenu2). #D and #E has to do the same, putting everything back to the begining.</p> <p>EDITED:</p> <p>thanks to Simon, I have more or less this: <a href="http://jsfiddle.net/PAXqB/4/" rel="nofollow">http://jsfiddle.net/PAXqB/4/</a></p> <p>the last implementation is to make it with .click() and not with .mouseover() having this 3 cases:</p> <ul> <li>case 1: Same than mouseover, all opened. </li> <li>case 2: Click again the same Main, all have to close like my example. </li> <li>case 3: Click on an other Main, close submenu, not suheader, and open the new submenu.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload