- 
      
- 
        Save INDIAN2020/08f6a2bbfbb436db13df to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $(document).ready(function() { | |
| /* Hide all elements outside the visible window */ | |
| $('body *').each( function(){ | |
| var top_of_object = $(this).position().top; | |
| var bottom_of_window = $(window).scrollTop() + $(window).height(); | |
| if( bottom_of_window < top_of_object ){ | |
| $(this).addClass('hideme').css({'opacity':'0'}); | |
| } | |
| }); | |
| /* Every time the window is scrolled ... */ | |
| $(window).scroll( function(){ | |
| /* Check the location of the desired elements */ | |
| $('.hideme').each( function(i){ | |
| var bottom_of_object = $(this).position().top + $(this).outerHeight(); | |
| var bottom_of_window = $(window).scrollTop() + $(window).height(); | |
| if( bottom_of_window > ( bottom_of_object + 20 ) ){ | |
| $(this).removeClass('hideme').animate({'opacity':'1'},500); | |
| } | |
| }); | |
| }); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment