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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:36:01+00:00 2026-05-23T23:36:01+00:00

Hi in my html document I have a call to a jQuery function. The

  • 0

Hi in my html document I have a call to a jQuery function. The function of the jQuery call is to toggle a header slider bar.

This is the full link with jQuery call:

<img src="http://www.wpinsite.com/wp-content/themes/wpinsite/gfx/down.png" onclick="jQuery('#wpqn_down').slideUp(function(){jQuery('#wpqn').slideDown();});" alt="" />

What I would like to do is also add enother jQuery call as well but I am not sure into with part of the code to put it. This is the code that I want to add to the above click event.

$("body").animate({marginTop: "40px"}, 500 );

So in a nutshell I would like two tings to happen on each click or toggle. On the first click I would like the click event to toggle or hide the header bar and ALSO to contract the “body” margin-top by -40px and on the second click I would like it to display the header bar and also expand the “body” margin-top by 40px;

You can see an example of what I am trying to achieve by visiting my website http://www.wpinsite.com
At the top of the page you will see a yellow header bar. On the page load I have a piece of jQuery that expand the body tag by 40px. When you click the toggle arrow it hides the header bar but it doesn’t contact the margin-top by -40px.

I hope this makes sense. Any help would be greatly appreciated.

  • 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-23T23:36:02+00:00Added an answer on May 23, 2026 at 11:36 pm

    Add an id or class to your img tag like this:

    <img class="downButton" src="http://www.wpinsite.com/wp-content/themes/wpinsite/gfx/down.png" alt="" />
    

    Then do something like this in jQuery:

    jQuery('img.downButton').click(function(){
      jQuery('#wpqn_down').slideUp(function(){
        jQuery('#wpqn').slideDown();
      });
      $("body").animate({marginTop: "40px"}, 500 );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this javascript function: jQuery(document).ready(function() { FB.api('/me/friends', function(response) { if(response.data) { $.each(response.data,function(index,friend) {
I have an <img> in an HTML document that I would like to highlight
I have index.php like this: <script type=text/javascript src=jquery-1.4.2.js></script> <script type=text/javascript src=ajax.js></script> <a href='one.php' class='ajax'>One</a>
here is the case. with jquery ajax call i have added a new link
I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $(#startDate).Val(); jQuery(#sandgrid).jqGrid({
I have problem with call any jQuery function. The load is working, but when
In the top part of my document I have this Jquery code: // RATING
Im trying to call a js function on a HTML element which I have
<script type=text/javascript src=js/jquery-1.3.1.min></script> <script type=text/javascript> $(document).ready(function() { //Execute the slideShow slideShow(); }); function slideShow()
My html document looks like this: <html> <head> .. load jquery and other stuff

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.