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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:08:13+00:00 2026-06-06T03:08:13+00:00

I started by trying to add a .toggle() to this code so that the

  • 0

I started by trying to add a .toggle() to this code so that the menu will animate on click but also close on a click, then realized that I can’t use the .animate within a .toggle() very well so i’m trying out .click()

If there is a way to replace my mouseenter and mouseleave functions with a click that is what I am looking for.

I’ve searched but I can’t find anywhere this has been done with an animated menu so, here is the javascript for the function:

$('#sdt_menu > li').bind('mouseenter',function(){
    var $elem = $(this);
    $elem.find('img')
         .stop(true)
         .animate({
            border: '5px solid #000',

            'width':'150px',
            'height':'170px',
            'left':'0px'
         },400,'easeOutBack')
         .andSelf()
         .find('.sdt_wrap')
         .stop(true)
         .animate({'top':'140px'},500,'easeOutBack')
         .andSelf()
         .find('.sdt_active')
         .stop(true)
         .animate({'height':'170px'},300,function(){
        var $sub_menu = $elem.find('.sdt_box');
        if($sub_menu.length){
            var left = '170px';
            if($elem.parent().children().length == $elem.index()+1)
                left = '-170px';
            $sub_menu.show().animate({'left':left},200);
        }    
    });
}).bind('mouseleave',function(){
    var $elem = $(this);
    var $sub_menu = $elem.find('.sdt_box');
    if($sub_menu.length)
        $sub_menu.hide().css('left','0px');

    $elem.find('.sdt_active')
         .stop(true)
         .animate({'height':'0px'},300)

         .andSelf().find('img')
         .stop(true)
         .animate({
            border: "2px solid #FFFFFF",
            'width':'150px',
            'height':'150px',
            'left':'0px'},400)
         .andSelf()
         .find('.sdt_wrap')
         .stop(true)
         .animate({'top':'25px'},500);
});
  • 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-06T03:08:14+00:00Added an answer on June 6, 2026 at 3:08 am

    Below I add a class if it opens, and remove a class if it closes which tells the onclick event what to do.

    Check out http://api.jquery.com/toggle-event/. Simple enough.

    Credit to apsillers.

    $('#sdt_menu > li').toggle(function(){
        var $elem = $(this);
        var $sub_menu = $elem.find('.sdt_box');
        $elem.find('img')
             .stop(true)
             .animate({
                border: '5px solid #000',
    
                'width':'150px',
                'height':'170px',
                'left':'0px'
             },400,'easeOutBack')
             .andSelf()
             .find('.sdt_wrap')
             .stop(true)
             .animate({'top':'140px'},500,'easeOutBack')
             .andSelf()
             .find('.sdt_active')
             .stop(true)
             .animate({'height':'170px'},300,function(){
            if($sub_menu.length){
                var left = '170px';
                if($elem.parent().children().length == $elem.index()+1)
                    left = '-170px';
                $sub_menu.show().animate({'left':left},200);
            }    
        });
    }, function(){      
        var $elem = $(this);
        var $sub_menu = $elem.find('.sdt_box');
        if($sub_menu.length)
            $sub_menu.hide().css('left','0px');     
        $elem.find('.sdt_active')
             .stop(true)
             .animate({'height':'0px'},300)     
             .andSelf().find('img')
             .stop(true)
             .animate({
                border: "2px solid #FFFFFF",
                'width':'150px',
                'height':'150px',
                'left':'0px'},400)
             .andSelf()
             .find('.sdt_wrap')
             .stop(true)
             .animate({'top':'25px'},500);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started out trying to add meta tags in the <head> tags but now
I'm trying to add a server in pgAdmin 3 to get started, but somehow
I'm trying to add a new entry into Internet Explorer's right-click context menu. I
I just started trying my hands on EF4 code first this morning and I
I am trying to setup jQuery rows, with add/remove row functionality. I got started
this is my first post on this website, Anyway, I recently started trying to
I'm trying to add multithreading to a Python app, and thus started with some
I've started a new job this week and am trying to get my head
So here's the deal: I read this article and started trying to use Rhino.
I am trying to get started with LLVM in order to add just-in-time compilation

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.