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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:44:14+00:00 2026-05-21T02:44:14+00:00

Ok, so I have a whole page hide / fadeIn effect happening with jQuery.

  • 0

Ok, so I have a whole page hide / fadeIn effect happening with jQuery. Everything was working smoothly until I realized that the delay() + fadeIn() is causing my

<a href="http://example.com/my_page/#my_ID">Hashtag Links</a>

to load with the scroll position at the top rather than where that #my_ID is on the page.

I know this is related to the whole page delay() // fadeIn() effects. It’s not an option for me to ditch these effects, any way to circumvent this problem?

You can view the site (in production) at

http://valeriaentertainment.com.s66112.gridserver.com/

EDIT

This is the relevant jQuery code:

// #curtain DIV begins hidden then fades in after #bgImage (curtain) is loaded - prevents "ribbon" loading effect in Chrome

var allDone = false;
var url = $('.bgImage').attr('src');
var img = new Image();
img.onload = function() {
  if (!allDone) {
    $('#curtain').delay(1500).fadeIn(1000);
    allDone = true;
  }
};
setTimeout(img.onload, 2000); // show the hidden stuff after 5 seconds, image or no image
img.src = url;
  • 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-21T02:44:15+00:00Added an answer on May 21, 2026 at 2:44 am

    At first glance at a gallery page, it looks like the entire page content is initially hidden. When the browser is loading the page, it will start looking for the element identified in the URL fragment; that element will be hidden or not visible and hence it won’t have any useful position to scroll to and nothing happens to the scroll position.

    I think the easiest thing to do would be to handle the scrolling yourself in the .fadeIn() callback:

    • Grab the fragment out of window.location.hash.
    • Find out where it is on the page with something like:
      var y = $('#' + window.location.hash).offset().top;
    • Then scroll the page to that position:
      $('html,body').attr('scrollTop', y);

    You could even animate the scrollTop change if you wanted to get fancy.

    Here’s an example to get you started:

    $('#curtain').delay(1500).fadeIn(1000, function() {
        // Bail out if there is no hash.
        if(!window.location.hash)
            return;
    
        // Convert the hash to an element and bail out
        // if there is no such element.
        var $e = $(window.location.hash);
        if($e.length < 1)
            return;
    
        // And, finally, do what we're here to do.
        $('html,body').attr('scrollTop', $e.offset().top);
    });
    

    If you wanted to animate the scrolling then you’d change the $('html,body').attr(...) part to something like this:

    $('html,body').animate({ scrollTop: '+=' + $e.offset().top }, 'fast');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please have a look at this demo page that I cooked up a while
I have a script that takes a while. I'd like to display a page
I have an element that fades in, its the size of the page and
I have a div that I would like to refresh on page load then
Here I have the page already loaded... it hides until clicked. Once clicked the
I have a dialog window that uses a URL for its contents { function(){jQuery.ajax({'success':function(html)
So I have a div that is automatically set to display none on page
So, what I have is a page where there is a whole lot of
I have a page (index.php) that pulls posts from mysql database. The posts are
Really quick question - (I hope!) I have a div that doesnt display until

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.