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

  • Home
  • SEARCH
  • 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 9174669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:47:26+00:00 2026-06-17T16:47:26+00:00

I am trying to add an animation/fade to a show/hide script. When the user

  • 0

I am trying to add an animation/fade to a show/hide script.

When the user clicks the “.show” anchor, I would like to slide down the “.buttons” div by the height of the “.targetDiv” div, after-which I would like the “.targetDiv” div to fade in.

Then (if possible), I would like the reverse action to occur when the “.hide” anchor is clicked – causing the “.targetDiv” to fade out, and the “.buttons” div to slide upwards (back to its original position).

Thank you for your help!

jsFiddle:

http://jsfiddle.net/XwN2L/1296/

HTML:

    <div id="content" class="targetDiv">Content</div>
    <div class="buttons">
        <a  class="show" target="content">Show</a>
        <a  class="hide" target="content" style="float: right;">Hide</a>
    </div>

JavaScript:

    $('.targetDiv').hide();
    $('.show').click(function () {
        $('.targetDiv').hide();
        $('#' + $(this).attr('target')).show();
    });

    $('.hide').click(function () {
        $('#' + $(this).attr('target')).hide();
    });
  • 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-17T16:47:27+00:00Added an answer on June 17, 2026 at 4:47 pm

    one option:

    give your elements absolute positioning:

    position: absolute;
    top:0px;
    

    then animate it like so:

    $('.show').click(function () {
            $('.targetDiv').hide();
            $('.buttons').animate({
                top : '80px' // the height of your content + the padding + the margins
            },'slow',function(){
                $('#content').fadeIn('slow');
            });
    });
    
    
    $('.hide').click(function () {
        $('#content').fadeOut('slow',function(){
            $('.buttons').animate({
                top : '0px' // the height of your content + the padding + the margins
            });
        });
    });
    

    working example: http://jsfiddle.net/XwN2L/1298/

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

Sidebar

Related Questions

I'm trying to add an animation to my ListView so text will fade into
I'm trying to add an animation to my TabActivty. For example, when the user
I am trying to add one UIView with a transition style zoom animation like
i am trying to add animation to move my buttons from left to right.
I'm trying to add a swipe animation to an element. I've tried initializing jqTouch
I am trying to add a bounce effect to my animation but am having
I'm trying to figure out a nice way to add a busy animation to
I am trying to add a little animation with jQuery to my navigation bar.
I'm trying to make an image fade in/out when the user hovers over the
I am trying to add animation for UIImages which are added in an array.

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.