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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:49:21+00:00 2026-05-30T08:49:21+00:00

I am teaching myself jquery it seems while working on this project. I assumed

  • 0

I am teaching myself jquery it seems while working on this project.

I assumed that there would be a very simple way to implement this technique, but I have searched high and low with no luck. Here is there the page we are looking at:

http://igs.link-networkonline.com/campaign-landing-page/

The three pull up menus in the middle are what we are looking at. They are almost finished, I just need help fixing some bugs.

  1. The div underneath the tabs slides down when the tab slides up. It is most likely because I am using negative positioning to more the menu up… I didn’t know what else to do!

  2. If one is open, when you click another the first closes.

These questions are very close to complete, they just are not functioning the way a user would expect, and the code is getting rather bulky to keep in the header.

The problems that I am having now:

a. When one is open while a first is already open, it closes the first, but to negitive margin used on the bottom div gets increased by too much, resulting in the bottom div interfering with the above content.

b. After the initial open/close toggle, it takes 2 clicks to toggle it, resulting in the page feeling broken.


Updated code:

$(function() {
    $(".first").toggle(function() {
        $(".first").animate({'height': '295px', 'top': "-220px"});
        $('.first img').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
        $(".second").animate({'height': '75px', 'top': "0px"});
        $(".third").animate({'height': '75px', 'top': "0px"});
        $(".campaign-lower").animate({'margin-top': '-220px'});
        $(".form").animate({'margin-top': '-220px'});

    }, function() {
        $(".first").animate({'height': '75px', 'top': "0px", 'overflow': "hidden"});
        $('.first img').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
        $(".campaign-lower").animate({'margin-top': '0px'})
        $(".form").animate({'margin-top': '0px'});

    });
   $(".second").toggle(function() {
        $(".second").animate({'height': '275px', 'top': "-200px"});
        $('.second img').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
        $(".first").animate({'height': '75px', 'top': "0px"});
        $(".third").animate({'height': '75px', 'top': "0px"});
        $(".campaign-lower").animate({'margin-top': '-200px'});
        $(".form").animate({'margin-top': '-200px'});

    }, function() {
        $(".second").animate({'height': '75px', 'top': "0px"});
        $('.second img').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
        $(".campaign-lower").animate({'margin-top': '0px'});
        $(".form").animate({'margin-top': '0px'});
    });
    $(".third").toggle(function() {
        $(".third").animate({'height': '255px', 'top': "-180px"});
        $('.third img').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
        $(".first").animate({'height': '75px', 'top': "0px"});
        $(".second").animate({'height': '75px', 'top': "0px"});
        $(".campaign-lower").animate({'margin-top': '-180px'});
        $(".form").animate({'margin-top': '-180px'});

    }, function() {
        $(".third").animate({'height': '75px', 'top': "0px"});
        $('.third img').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
        $(".campaign-lower").animate({'margin-top': '0px'});
        $(".form").animate({'margin-top': '0px'});
    });

}); 

Very grateful for any ideas or direction. Thanks you in advance for your knowledge!

  • 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-30T08:49:23+00:00Added an answer on May 30, 2026 at 8:49 am

    A simple way to do this is to animate e.g. .second and .third on .first click to close, animate .first and .third to close on .second click and so on…

    You could change the image with something like this:

    $('.first img').attr('src','new_source.png');
    

    Edit:

    The bottom box will stay with this animate:
    Note that it’s a really inelegant way of solving this, but it works:

        $(".first").toggle(function() {
                $(".first").animate({'height': '270px', 'top': "-220px"});
                $(".second").animate({'height': '50px', 'top': "0px"});
                $(".third").animate({'height': '50px', 'top': "0px"});
                $("#bottom").animate({'margin-top': '-220px'});
            }, function() {
                $(".first").animate({'height': '50px', 'top': "0px"});
                $("#bottom").animate({'margin-top': '0px'});
        });
    

    Edit 2:

    This should work for you now:

    var first = false;
    var second = false;
    var third = false;
    
        $(".first").click(function() {
            if(!first){
                first = true;
                second = false;
                third = false;
                $(".second").css({'margin-bottom': '0px'});
                $(".third").css({'margin-bottom': '0px'});
                $(".first").animate({'height': '295px', 'top': "-270px"},function() {
                    $(".first").css({'margin-bottom': '-220px'});
                });
                $(".second").animate({'height': '75px', 'top': "-58px"});
                $(".third").animate({'height': '75px', 'top': "-58px"});
                $("img.button1").animate({'top': "-235px"});
                $("img.button2").animate({'top': "-25px"});
                $("img.button3").animate({'top': "-25px"});
                $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
                $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
                $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
            } else if(first) {
                first = false;
                second = false;
                third = false;
                $(".first").css({'margin-bottom': '0px'});
                $(".first").animate({'height': '75px', 'top': "-58px"});
                $("img.button1").animate({'top': "-25px"});
                $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
            }
        });
       $(".second").click(function() {
            if(!second){
                first = false;
                second = true;
                third = false;
                $(".first").css({'margin-bottom': '0px'});
                $(".third").css({'margin-bottom': '0px'});
                $(".second").animate({'height': '295px', 'top': "-270px"},function() {
                    $(".first").css({'margin-bottom': '0px'});
                    $(".second").css({'margin-bottom': '-220px'});
                    $(".third").css({'margin-bottom': '0px'});
                });
                $(".first").animate({'height': '75px', 'top': "-58px"});
                $(".third").animate({'height': '75px', 'top': "-58px"});
                $("img.button2").animate({'top': "-240px"});
                $("img.button1").animate({'top': "-25px"});
                $("img.button3").animate({'top': "-25px"});
                $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
                $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
                $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
            } else if(second) {
                first = false;
                second = false;
                third = false;
                $(".second").css({'margin-bottom': '0px'});
                $(".second").animate({'height': '75px', 'top': "-58px"});
                $("img.button2").animate({'top': "-25px"});
                $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
                $("body").animate({'padding-bottom': '0px'});
            }
        });
        $(".third").click(function() {
            if(!third){
                first = false;
                second = false;
                third = true;
                $(".first").css({'margin-bottom': '0px'});
                $(".second").css({'margin-bottom': '0px'});
                $(".third").animate({'height': '295px', 'top': "-270px"},function() {
                    $(".third").css({'margin-bottom': '-220px'});
                });
                $(".second").animate({'height': '75px', 'top': "-58px"});
                $(".first").animate({'height': '75px', 'top': "-58px"});
                $("img.button3").animate({'top': "-210px"});
                $("img.button1").animate({'top': "-25px"});
                $("img.button2").animate({'top': "-25px"});
                $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png');
                $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
                $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
             } else if(third) {
                first = false;
                second = false;
                third = false;
                $(".third").css({'margin-bottom': '0px'});
                $(".third").animate({'height': '75px', 'top': "-58px"});
                $("img.button3").animate({'top': "-25px"});
                $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png');
                $("body").animate({'padding-bottom': '0px'});
            }
        });
    

    Note that this is not the way how to really solve something like this, but it works..

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

Sidebar

Related Questions

So, I'm working on teaching myself jQuery with the help of some books, and
I am teaching myself C# (I don't know much yet). In this simple example:
I'm teaching myself CSS and HTML, and I've come across something that seems like
I am teaching myself Ruby on Rails. I would like to make website that
Background: I'm teaching myself about packet sniffing. I run a very simple server in
I'm teaching myself Python and my most recent lesson was that Python is not
I'm teaching myself some basic scraping and I've found that sometimes the URL's that
I'm teaching myself CSS through books and websites. I've made a simple site with
How do, I've been teaching myself a little basic jQuery recently, doing so I
Teaching myself C and finding that when I do an equation for a temp

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.