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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:37:03+00:00 2026-05-13T07:37:03+00:00

If you click the dropdowns at this site: http://ryanbent.com/ – I want each of

  • 0

If you click the dropdowns at this site: http://ryanbent.com/ – I want each of those tabs to only OPEN one at a time. If you click one, then close the other.

I understand the thought behind it, i sent a class when you click it, and I am trying to go through each of them, but I cant seem to get it to work. I think its my selectors. My code is below:

function HideMenu(){
    //$('.open').stop().animate({'top':'-480px'},500,"linear");
    $('.open').slideUp();
    $(this).removeClass("open");
    $("#fuzz").fadeOut();
}
function checkMenu(){ $('.open').slideUp(); }
    $('#contact').toggle(function() {
    checkMenu();
    $('#contact-pull').show().animate({'top':'-50px'}).addClass("open");
    //$('#contact-pull').slideDown();
}, function() {
    HideMenu();
    $('#contact-pull').animate({'top':'-180px'})
});     
$('#about').toggle(function() {
    checkMenu();         
    $('#about-pull').show().animate({'top':'55px'}).addClass("open");                
    // $('#about-pull').slideDown();
}, function() {
    HideMenu();
    $('#about-pull').animate({'top':'-465px'})
});     
$('#portfolio').toggle(function(){
    checkMenu();
    $('#portfolio-pull').animate({'top':'75px'}).addClass("open");
}, function() {
    HideMenu();
    $('#portfolio-pull').animate({'top':'-150px'});
});

Does anyone have any suggestions on how I can get this working? I have been struggling with this and cant seem to get it to work. I set the flag fine, but I need to check for 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-05-13T07:37:03+00:00Added an answer on May 13, 2026 at 7:37 am

    You could take a cleaner approach where you wouldn’t have to init each menu item individually but to just edit your existing code you could try something like this:

        function HideMenu(){
                $('.open').stop().animate({'top':'-180px'},500,"linear",function(){
                        $(this).removeClass("open");
                        $(this).hide();
                });
        }
    
        $('#contact').toggle(function() {
                $('#contact-pull').show().animate({'top':'-50px'}).addClass("open");
        }, function() {
                HideMenu();
                $('#contact-pull').animate({'top':'-180px'})
                $("#fuzz").fadeOut();
        });     
        $('#about').toggle(function() {
                var h = $('#about-pull').height();
                var new_t = h-380;
                $('#about-pull').show().animate({'top':new_t}).addClass("open");                
        }, function() {
                HideMenu();
                $('#about-pull').animate({'top':'-350px'})
                $("#fuzz").fadeOut();
        });     
        $('#portfolio').toggle(function() {
                var h = $('#portfolio-pull').height();
                var new_t = h-70;
                $('#portfolio-pull').animate({'top':new_t}).addClass("open");
        }, function() {
                HideMenu();
                $('#portfolio-pull').animate({'top':'-150px'})
                $("#fuzz").fadeOut();
        });
    

    The changes I made were:

    • You don’t need to call “HideMenu” in an each loop the function can just find the relevant (open) menu and close it.
    • You seemed to be using both “open” and “openMenu” as class names in your code, I changed it to just use “open”.
    • You weren’t calling the HideMenu function in the handler for #about as there was no () after it.
    • You weren’t even trying to call the HideMenu function in the handler for #portfolio

    Hope it helps – I didn’t test it, just corrected the errors that jumped out at me 🙂

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

Sidebar

Related Questions

To make click-able divs, I do: <div class=clickable url=http://google.com> blah blah </div> and then
The 'click sound' in question is actually a system wide preference, so I only
Dropdown In my site I have a set of SELECT dropdowns that are set
User click on a link button and it will direct them to a url
How to add a click event listener to my custom control made with wxWidgets?
When using $('.foo').click(function(){ alert(I haz class alertz!); return false; }); in application.js, and <a
When you double click on a class (in 'solution explorer')... if that class happens
When I right-click a solution in VS2008 and select Check In... I am presented
Upon a click on an IMG, I would like to get to the next
Below is an image from a site that hase user photo's, they link to

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.