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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:51:26+00:00 2026-05-29T11:51:26+00:00

UPDATE: I added this to my unload function: $(window).resize(function(){ var pageheight = $(window).height(); $(‘section’).css(‘height’,

  • 0

UPDATE: I added this to my unload function:

$(window).resize(function(){
        var pageheight = $(window).height();
        $('section').css('height', pageheight)
    });

it works but performance is AWFUL on resizing of the window. Any suggestions?

I’ve got a page. There are two areas, header & section. Both are 100% of the pageheight (on page load, this is important). When you click the “begin” button, they both move up. Header is hidden and section comes into view.

This is all done by jQuery fetching the page height on page load. And so it works well, until you resize the browser window, then everything is off since the variable “page height” has changed. How can I keep the page height variable constantly updating so as I resize the browser window, it’s responsive?

Here’s the site: http://hashtraffic.com/

Click “begin” to see the scrolling effect.

Here’s the jQuery:

jQuery.fn.center = function (absolute) {
    return this.each(function () {
        var t = jQuery(this);

        t.css({
            position:   absolute ? 'absolute' : 'absolute', 
            left:       '50%', 
            top:        '50%', 
            zIndex:     '99'
        }).css({
            marginLeft: '-' + (t.outerWidth() / 2) + 'px', 
            marginTop:  '-' + (t.outerHeight() / 2) + 'px'
        });

        if (absolute) {
            t.css({
                marginTop:  parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(), 
                marginLeft: parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
            });
        }
    });
};

$(function(){
    var pageheight = $(window).height();
    $('section, header').css('height', pageheight)
    $('h1').delay(500).fadeTo(1000, 1);
    $('h2').delay(1000).fadeTo(1000, 1);
    $('h3').delay(1500).fadeTo(1000, 1);
    $('section').delay(500).fadeTo(1000, 1)
    $('hgroup').center();
    $('p').center()
    $('h3').click(function(){
        $('hgroup').animate({marginTop: -2*pageheight}, 300);
        $('section').animate({marginTop: -pageheight}, 300);
        $('p').delay(4000).fadeOut(function() {
            $(this).text("The internet is both the most powerful #interconnectivity mechanism we have, and is the crux of our #collectiveintelligence.").fadeIn()
            $(this).delay(4000).fadeOut(function(){
                $(this).text("It's also the fastest growing industry in the world. Earlier this year, the number of internet ads surpassed the number of printed ads. That's huge.").fadeIn()
                $(this).delay(4000).fadeOut(function(){
                    $(this).text("It's also the fastest growing industry in the world. Earlier this year, the number of internet ads surpassed the number of printed ads. That's huge.").fadeIn()
                    $(this).delay(4000).fadeOut(function(){
                        $(this).text("It's also the fastest growing industry in the world. Earlier this year, the number of internet ads surpassed the number of printed ads. That's huge.").fadeIn()
                        $(this).delay(4000).fadeOut(function(){
                            $(this).text("It's also the fastest growing industry in the world. Earlier this year, the number of internet ads surpassed the number of printed ads. That's huge.").fadeIn()
                            $(this).delay(4000).fadeOut(function(){
                                $(this).text("It's also the fastest growing industry in the world. Earlier this year, the number of internet ads surpassed the number of printed ads. That's huge.").fadeIn()
                            });
                        });
                    });
                });
            });
        });
    });
});

And the CSS:

* {
    margin: 0;
    padding: 0;
}
body {
    background: #FFF;
    overflow: hidden;
}
header {
    text-align: center;
    top: 50%;
    height: 100%;
    width: 100%;
}
h1 {
    font: 300 10em Anivers;
    text-shadow: 3px 3px 0 #FFF;
    position: relative;
    opacity: 0;
}
h2 {
    font: 300 3.5em Anivers;
    text-shadow: 3px 3px 0 #FFF;
    opacity: 0;
}
h3 {
    font: 300 3.5em Anivers;
    text-shadow: 3px 3px 0 #FFF;
    opacity: 0;
    cursor: pointer;margin-top: 75px;
    position: relative;
    left: 50%;
    margin-left: -75px;
    font: 100 3em Anivers;
    width: 150px;
    border: 4px solid #000;
    -webkit-border-radius: 30px;
}
p {
    font: 300 1.5em Anivers;
    text-align: center;
    position: relative !important;
    width: 800px;

}
section {
    height: 100%;
    width: 100%;
    opacity: 0;
}

Pageheight I’m guessing needs to be a percentage value, but you can’t animate percentage values with jQuery so I’m a bit suck.

Thanks!

  • 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-29T11:51:29+00:00Added an answer on May 29, 2026 at 11:51 am

    If you are truly concerned about performance, I would highly recommend Ben Almans Throttle / Debounce plugins. They have been designed for exactly this purpose.

    The plugins can be found at http://benalman.com/projects/jquery-throttle-debounce-plugin/

    Ben goes on to explain how the resize event gets fire continuously in some browsers which affects performance greatly.

    On the example page: http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/ you can see the result of ‘throttling’ the resize event

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

Sidebar

Related Questions

EDIT: Modified title and added update. UPDATE : We no longer believe this is
In my CMS I've added this code <div><?php include(my_contact_form.php) ?></div> which updates to a
I added a counter cache but can't get it to update. But I can
NOTE: I added my new solution at the UPDATE answer below. I try to
I'm using an Ajax update panel and have recently added ASP.NET tracing code to
There're files/folders that were deleted and then re-added to the repository. svn update >
hi this is my first attempt at JavaScript: the following function is used to
Update : This gem DOES install with sudo rake gems:install. The problem is with
I was just going to update my iPhone app. I've added the What's New
UPDATE : added an example to clarify the format of the data. Considering a

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.