Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7666007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:43:28+00:00 2026-05-31T14:43:28+00:00

i have for example a header (140px height) on the web with 5 li

  • 0

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.

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");
        });
    });

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)

        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");

        });

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.

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.

EDITED:

thanks to Simon, I have more or less this: http://jsfiddle.net/PAXqB/4/

the last implementation is to make it with .click() and not with .mouseover() having this 3 cases:

  • case 1: Same than mouseover, all opened.
  • case 2: Click again the same Main, all have to close like my example.
  • case 3: Click on an other Main, close submenu, not suheader, and open the new submenu.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:43:30+00:00Added an answer on May 31, 2026 at 2:43 pm

    I must say I had to read your question multiple times and I’m not yet sure if I understood you right, but is this what you wanted to achieve? http://jsfiddle.net/PAXqB/

    $(document).ready( function() {
        $('ul.main > li').bind('mouseover mouseout', function(e) {
            var t = $(this), i = t.index(), sub = t.find('.sub');
            if(i < 3)
                switch(e.type) {
                    case 'mouseover':
                        sub.stop(true).slideDown( function() {
                            $(this)
                                .stop(true)
                                .animate({ margin:"20px 0 0" })
                                .find('li')
                                .stop(true)
                                .animate({ padding:"0 10px 0" });
                        });
                        break;
                    case 'mouseout':
                        sub.stop(true).slideUp('fast', function() {
                            $(this)
                                .removeAttr('style')
                                .find('li')
                                .removeAttr('style');
                        });
                        break;
                }
        });
    });
    

    I slightly adjusted the animate-to style so it looks a bit smoother on my jsfiddle, but I hope it helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple example with a header and content divs. I want there to
I have C header file containing the following type definition: // example.h typedef struct
I have an example class containing two data points: public enum Sort { First,
I have this code: #left-nav #left{ width:100px; height: 99px; float:left; border-bottom: 1px solid #344a53;
I like the functionality of the Filter in this example: http://mleibman.github.com/SlickGrid/examples/example-header-row.html where each column
Ok, I have code like this: <div id=header> (yeah, have to use div instead
How can I display only selected headers in DataGridView control? For example I have
I have example of code below. <script type=text/javascript src=assets/scripts/somescript.php>. </script> So, will my browser
If I have example.com/dir and dir is basically a folder in the example.com server,
Anyone have an example snippet showing how to scale a Font using AffineTransform? Thanks.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.