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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:47:33+00:00 2026-05-26T18:47:33+00:00

this is my script, I’m using a toggle so I can animate a sliding

  • 0

this is my script, I’m using a toggle so I can animate a sliding menu.

    $("div.show-menu").click().toggle(
        function() {
            // first alternation
            $("#slideover").animate({
                right: "512px"
                }, 300);
            $(".menu-button").html('close menu');


        }, function() {
            // second alternation
            $("#slideover").animate({
                right: "0"
                }, 300);
            $(".menu-button").html('open menu');

    });

Though I really need the toggle to work using 2 elements on the page. For example see below…

<div class="show-menu one">open menu</div> // this is element one

<div class="show-menu two">open menu</div> // this is element two

I need it so, if element one get’s click first, you can close the menu using element two on the first click. What is happening now is that you have to click element two twice in order for it to close the menu – vice versa

I guess this is the toggle coming into play, any help would be great thanks.

Cheers
Josh

  • 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-26T18:47:34+00:00Added an answer on May 26, 2026 at 6:47 pm
    $('.show-menu').on('click', function () {
    
        //check the state of the .menu-button, if it's closed then run the open animation, if it's open then run the close animation
        if ($(".menu-button").html() == 'close menu') {
            $("#slideover").animate({
                right: "0"
            }, 300);
            $(".menu-button").html('open menu');
        } else {
            $("#slideover").animate({
                right: "512px"
            }, 300);
            $(".menu-button").html('close menu');
        }
    });
    

    .on() is new in jQuery 1.7 and replaces .bind() in this instance, if you are using jQuery < 1.7 then use .bind().

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

Sidebar

Related Questions

This script only runs once. I click a button and it changes the menu.
This script shows and positions a div like: function myfunction() { obj.style.visibility = visible;
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I'm using this script to display all the images in a folder, but I
Can someone explain why this script throws an exception? $byteArray = @(1,2,3) write-Output (
I've got this script on my website : $(document).ready(function() { function filterPath(string) { return
This script: <?php $lines[] = ''; $lines[] = 'first line '; $lines[] = 'second
This script sets a random color to the body and a div and should
This script works perfectly in all the browsers, except Google Chrome. $(document).ready(function(){ $(.banners-anim img).each(function(){
I have been using this script of mine FOREVER and I have always been

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.