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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:38:55+00:00 2026-06-01T08:38:55+00:00

What I want is an animated div which will toggle height between 300px and

  • 0

What I want is an animated div which will toggle height between 300px and 100% of the window height minus 26 px. The problem i’m facing is that the div wont update it’s expanded size after a window resize. I always want it to expand to windowheight-26px, but right now it only toggles to the first windowheight, it doesnt update. The code that i have right now is:

$j(document).ready(function(){

var $nh = $j(window).height()-26;   

$j("#header-wrap").toggle(function(){
    toggleHeaderDown($nh);
},function(){
    toggleHeaderUp();
});

function toggleHeaderDown(y){
    $j("#header-wrap").animate({height:y},400,'easeInOutQuart');
    $j("#header-image").animate({height:'100%'},400,'easeInOutQuart');
    $j("#head1, #head2, #head3, #head4").animate({top: 0},400,'easeInOutQuart');
};
function toggleHeaderUp(){
    $j("#header-wrap, #header-image").animate({height:300},400,'easeInOutQuart');
    $j("#head1").animate({top: -50},400,'easeInOutQuart');
    $j("#head2").animate({top: -370},400,'easeInOutQuart');
    $j("#head3").animate({top: -200},400,'easeInOutQuart');
    $j("#head4").animate({top: -330},400,'easeInOutQuart')
};});



$j(window).resize(function() {

$nh = $j(window).height()-26;

});
  • 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-01T08:38:56+00:00Added an answer on June 1, 2026 at 8:38 am

    I would calculate $nh at toggleHeaderDown:

    function toggleHeaderDown() {
           $nh = $j(window).height() - 26;
           // ...
    }
    

    That way you don’t need to wait the resize event to get the correct value for height

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

Sidebar

Related Questions

I have four div s which are animated using size, height and positions; that
I have a image inside a div which is 100*100 , i want to
I want to be able to rotate a moving sprite which is also animated
So I'm building a website that will use a lot of animated GIF's on
when animate function will decrease the height & width of div then any other
I've got some code that uses toggle to show and hide a div, but
I have two divs which I want to animate: <div id="character"> <div id="sprite"></div> </div>
I want to have a div that animates the currently active image out of
I have a series of div's that I want to highlight with a blue
I want to add animated pictures (GIF) on my wall like this http://www.facebook.com/tc.turkiy3m.tc?sk=app_4949752878 How

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.