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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:53:26+00:00 2026-05-26T12:53:26+00:00

Ok, so I’ve worked through a number of bugs in the following short script.

  • 0

Ok, so I’ve worked through a number of bugs in the following short script.

You can see a working demo here: http://jsfiddle.net/XG24G/2/

Sorry for giving such an expansive context here, but when I plug the snippet from that JSFiddle.net example into the following code, my javascript console is giving me an Uncaught TypeError: Cannot read property 'top' of null. Oddly, this error is not present when checking the console for the JSFiddle example I posted above.

Here is my javascript (again sorry for the spam, but I need to show the full context here):

EDIT: I had pasted the wrong code in here previously, I’ve fixed it now

$(window).scroll(function(){
        // gets the position of the window
          var y = $(window).scrollTop();

        $(".popup_next").each(function() {
            var $parentOffset = $(this).parent('article').offset().top;
            var $hideOffset = $parentOffset + 30;
            if( y > ($parentOffset) && y < ($hideOffset) ) {
                $(this).fadeIn('350');}
            if( y > ($hideOffset) ) {
                $(this).fadeOut('500');}
            if( y < ($parentOffset) ) {
                $(this).fadeOut('500');}            
        });



        // for .popup_01 div
        // fades a div in if it's within the scroll range and then back out if it's not
          if( y > (2460) && y < (2650) ){
            $(".popup_01").fadeIn('350');}
          if( y > (2650) ){
            $(".popup_01").fadeOut('500');}
          if( y < (2460) ){
            $(".popup_01").fadeOut('500');}

        // for .popup_02 div
        // fades a div in if it's within the scroll range and then back out if it's not
          if( y > (2750) && y < (3050) ){
            $(".popup_02").fadeIn('350');}
          if( y > (3050) ){
            $(".popup_02").fadeOut('500');}
          if( y < (2750) ){
            $(".popup_02").fadeOut('500');}


        // for .popup_03 div
        // fades a div in if it's within the scroll range and then back out if it's not
          if( y > (5878) && y < (6378) ){
            $(".popup_03").fadeIn('350');}
          if( y > (6378) ){
            $(".popup_03").fadeOut('500');}
          if( y < (5878) ){
            $(".popup_03").fadeOut('500');}

});


// invoke jQuery.parallax-1.1.js and call related variables 

    //.moveRelative() options:
    //x position
    //adjuster (y position to start from)
    //inertia (speed to move relative to vertical scroll)
    //outerHeight (true/false)
    $('#first').moveRelative("50%", 742, 0.05, true);
    $('#first .grid').moveRelative("50%", 742, 0.8, true);
    $('#third').moveRelative("50%", 4700, 0.08, true);
    $('#fourth').moveRelative("50%", 5550, 0.08, true);
    $('#fourth .overlay').moveRelative("50%", 5550, 0.14, true);
    $('#fifth').moveRelative("50%", 7300, 0.4, true);
    $('#sixth').moveRelative("50%", 7800, 0.2, true);
    $('#sixth .grid').moveRelative("50%", 0, 0.8, true);



// echo useragent string inside html element - useful for specific targeting of modern browsers
    var b = document.documentElement;
    b.setAttribute('data-useragent',  navigator.userAgent);
    b.setAttribute('data-platform', navigator.platform );

and here is my HTML

<article class="section" id="second">
<div id="hannah_bg">

<div class="popup popup_next popup_second"><div class="inner">
<a class="scroll" href="#third">⇓</a>
</div></div>

<div class="popup popup_01"><div class="inner">
<h2 class="unforgettable"><strong>unforgettable</strong></h2>
<h2 class="brand">brand identities</h2>
</div></div>

<div class="popup popup_02"><div class="inner">
<h2 class="powerful">Powerful</h2>
<h2 class="elegant">&amp; elegant</h2>
<p>development solutions that give<br>leverage to businesses of all sizes.</p>
</div></div>

</div><!-- /END #hannah_bg -->
</article><!-- /END #second -->
  • 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-26T12:53:26+00:00Added an answer on May 26, 2026 at 12:53 pm

    Use .closest() instead of .parent(). Since <article> is not the immediate parent of .popup_next, .parent() is returning an empty jQuery object and .offset() returns null.

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

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

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.