Fade out a div when scroller hits bottom of another div

This question sort of relates to this one: Append div to body when URL hash # changes

I'm using Curtain.js and currently I have a fixed div that pops up when the hash changes. I.E the div fades in when the user scrolls down the page to different panels. I don't want this div to be visible on the first panel.

The problem I now have is that when the visitor scrolls back up the page to the top the fixed div is still visible. I.e. appearing on top of the first panel. I would like to fade that div out as soon as it hits the bottom of that first panel. The other issue is that the panel's height adjusts to the height of the browser window (fluid/responsive layout) ruling out any fixed pixel JS solutions, which is what my code is based on:

// fade in/fade out banner titles $(window).trigger('scroll'); var divs = $('.nav-wrap'); $(window).scroll(function(){ if($(window).scrollTop() < 550){ divs.fadeOut("slow"); } else { divs.fadeIn("slow"); } });

Anyone have any suggestions??


you can use window.height() which returns the height of the browser's viewport:

var vp = $(window).height(); // height of the browser's viewport var divs = $('.nav-wrap'); $(window).scroll(function(){ if($(window).scrollTop() < vp){ divs.fadeOut("slow"); } else { divs.fadeIn("slow"); } });


  • Collapse plugin: Only show one panel at a time
  • Is it possible to post windows form Hit info to Google analytics(track id) using Gdata API C#
  • How to Unit Test GetNewValues() which contains EntityFunctions.AddDays function
  • Moving JPanels using TimerTask
  • use parameter from method argument inside linq contains
  • Calculating Unique events in Google-Bigquery
  • iPhone: Stop UIScrollView from auto scrolling when UITextView text is changed
  • How can I dynamically add controls to a form based on JComboBox selection?
  • Is there a way to act before the scroll event?
  • NSOpenPanel's setDirectoryURL doesn't work on Lion
  • Windows Forms switch between Panels
  • Unload image of UIImageView thats offscreen
  • Extjs, handling success or failure when doing a standard submit in a form
  • Accessing another variable in the same class with a click event
  • CSS how to fix an element to scroll horizontally with the page but not vertically?
  • Why can't UI components be accessed from a backgroundworker?
  • react split panel resize
  • How to getText() from the input field of an angularjs Application
  • How to disable all widgets inside Panel or inside Composite?
  • D3 get axis values on zoom event
  • CakePHP 2.0.4 - findBy magic methods with conditions
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • Change multiple background-images with jQuery
  • Algorithm for a smudge tool?
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • Can Jackson SerializationFeature be overridden per field or class?
  • How to set/get protobuf's extension field in Go?
  • Join two tables and save into third-sql
  • htaccess rewriting URLs with multiple forward slashes
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • How to model a transition system with SPIN
  • How to show dropdown in excel using jrxml (jasper api)?
  • Display Images one by one with next and previous functionality
  • ORA-29908: missing primary invocation for ancillary operator
  • Web-crawler for facebook in python
  • Data Validation Drop Down Box Arrow Disappearing
  • A cron job substitute?
  • Android Studio and gradle
  • Converting MP3 duration time