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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:27:18+00:00 2026-05-30T22:27:18+00:00

Check out code here ! These are my problems: Div won’t toggle to hide

  • 0

Check out code here!

These are my problems:

  1. Div won’t toggle to hide when self is clicked, only when i click another. ( edit: or basically anywhere )

  2. All divs that are supposed to be hidden blink in when page is loaded and then disappear. Any way to avoid that? ( solved it! css display:none;)

  3. The clicked div should keep its highlighted background color until another or self is clicked. Can’t figure that one out.

  4. (on the side) when i open the page on the ipad, the menu_row keeps its :hover backgroundcolor when clicked. That is ok, but when self is clicked and the showed div retracts it should revert to gray. Possible?

  • 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-30T22:27:20+00:00Added an answer on May 30, 2026 at 10:27 pm

    1.

    jQuery(document).ready(function($) {
    
        //cache the `.menuImage` elements since they will be used frequently
        var $menuImages = $(".menuImage").hide('slow');
        $(".menuItem").click(function() {
    
            //get the `.menuImage` element that is a child of the clicked element
            var $ele = $(this).children(".menuImage");
    
            //`.slideUp()` all the `.menuImage` elements that aren't a child of the clicked element
            $menuImages.not($ele).slideUp(500);
    
            //toggle the visibility of the child of the clicked element
            $ele.slideToggle(500);
        });
    });​
    

    Demo: http://jsfiddle.net/jasper/XcJwW/17/

    3.

    jQuery(document).ready(function($) {
        var $menuImages = $(".menuImage").hide('slow');
        $(".menuItem").click(function() {
            var $ele = $(this).children(".menuImage");
    
            //not only slide the rest of the `.menuImage` elements away, but also remove the `hover` class from them
            $menuImages.not($ele).slideUp(500).parent().removeClass('hover');
    
            //not only toggle the view of the clicked `.menuImage` element, but also toggle the `hover` class for the element
            $ele.slideToggle(500).parent().toggleClass('hover');
        });
    });​
    

    This requires a small tweak to your CSS:

    #menu_row1 .menuItem:hover, #menu_row1 .menuItem.hover { background:#ff0000; }
    #menu_row2 .menuItem:hover, #menu_row2 .menuItem.hover { background:#ffe100; }
    #menu_row3 .menuItem:hover, #menu_row3 .menuItem.hover { background:#0033cc; }
    

    Notice the user can either hover over one of these elements or you can give the element the hover class, both will have the same outcome.

    Demo: http://jsfiddle.net/jasper/XcJwW/20/

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

Sidebar

Related Questions

First check out this code. I seems like it should work for me, but
Are there any source code sharing system that lets you check in/out code on
Please check this code out it compiles and runs absolutely fine.. The question is
I sometimes check out some previous version of the code to examine or test.
If I check out a tagged version of my source code without creating a
Check out this test: [TestFixture] public class Quick_test { [Test] public void Test() {
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
I am trying to figure out the fastest way (in PHP 5) to check
I haven't got problems with code since my last problem with interface covariance. Today
I've got some problems with the following code in my PHP/MySQL application. It works

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.