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 8439263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:57:45+00:00 2026-06-10T07:57:45+00:00

I have this HTML code : <ul class=menu> <li>Home <span class=icon home></span><div class=clear></div></li> <li

  • 0

I have this HTML code :

<ul class="menu">
    <li>Home <span class="icon home"></span><div class="clear"></div></li>
    <li class="sub">Projects <span class="icon project"></span>
        <div class="clear"></div>
        <ul class="sub-menu">
            <li>Mfrsht.com</li>
            <li>Mawsuaty.com</li>
            <li>Dzlng.com</li>
            <li>Money(Ctrl)</li>
        </ul>
    </li>
    <li>Ideas <span class="icon idea"></span><div class="clear"></div></li>
    <li>Services <span class="icon service"></span><div class="clear"></div></li>
    <li>About us <span class="icon about"></span><div class="clear"></div></li>
    <li>Contact <span class="icon contact"></span><div class="clear"></div></li>
</ul>

and this Javascript code :

$(".menu > li").not(".menu > li.sub").css( {backgroundPosition: "0px 0px", height: "30px"} )
        .mouseover(function(){
            $(this).stop().animate({backgroundPosition:"(-167px 0px)", height: "36px"}, {duration:500})     
            })      
        .mouseout(function(){           
            $(this).stop().animate({backgroundPosition:"(0px 0px)", height: "30px"}, {duration:200, complete:function(){                $(this).css({backgroundPosition: "0px 0px"})            
            }})     
})

$(".menu > li.sub").css( {backgroundPosition: "0px 0px"} )
        .mouseover(function(){
            $(this).stop().animate({backgroundPosition:"(-167px 0px)"}, {duration:500}) 
            })      
        .mouseout(function(){           
            $(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200, complete:function(){                $(this).css({backgroundPosition: "0px 0px"})        
            }})     
})


$(".sub").hover(function() {
            $(this).animate({height: "150px"}, "slow", "", function () {
                $(this).children("ul.sub-menu").slideDown("slow");  
                });

    }, function() {
        $(this).animate({height: "30px"}, "slow");
        $(this).children("ul.sub-menu").slideUp("slow");    
        });

the Menu is working fine but sometimes I found it lag or there is some lateness so I want to improve it and make it better.

Note: I’m using background position plugin.

DEMO

Any suggestions? or do you think this good and no need to modify it?

  • 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-06-10T07:57:47+00:00Added an answer on June 10, 2026 at 7:57 am

    Couple of things to consider:

    1. Use mouseenter / mouseleave instead of mouseover / mouseout to actually get handlers fired when necessary (since you don’t care if muse moves cursor within area of menu item – only which item cursor entered and leaved).
    2. Use .stop(true) before running new animations in event handlers. You’re already doing it in couple of places, but you’ve missed some spots (and you’re not clearing the animation queue). Try to randomly move cursor around whole menu, then stop and watch the chaos. Event handlers are firing here and there, some items are “hovering”, some items are showing submenus, just to be hidden a sec later. By passing true to stop function, you’re telling jQuery to clear animation queue for matched object.
      You might also consider using second argument for .stop(), which will tell jQuery to just go ahead and set state in which object would be after completting whole animation. That (passing that second argument) would however depend on how you tweak your code, so don’t just do that – check if that’s a desirable effect in here.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I have this code in html: <div id=menu> <div id=memberDetails><h3><span>Welcome,</span><br /> <em>John Doe</em></h3> </div>
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
I have this HTML code : <ul class=navigation-links> <li class=link-item> <img src=images/new-menu/menu-item_04.png width=150 height=41
I have this HTML code : <ul class=navigation-links> <li class=link-item> <img src=images/new-menu/menu-item_04.png width=150 height=41
I have this HTML code: <div id=main> <div id=dv_7>...</div> <div id=dv_1>...</div> <div id=dv_8>...</div> <div
I have some code in HTML and CSS where HTML looks like this: <div
i have this html code <table style=width: 100%;> <tr> <td> ID </td> <td> <input

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.