Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     componentDidMount(){
  2.       window.addEventListener('scroll', this.checkIfBottom());
  3.     }
  4.  
  5.     componentWillUnmount() {
  6.       window.removeEventListener('scroll', this.checkIfBottom());
  7.     }
  8.  
  9.     checkIfBottom(){
  10.       var thatElement = $('#repereBottom')
  11.       var pos = thatElement.offset(),
  12.       wX = $(window).scrollLeft(), wY = $(window).scrollTop(),
  13.       wH = $(window).height(), wW = $(window).width(),
  14.       oH = thatElement.outerHeight(), oW = thatElement.outerWidth();
  15.       if (pos.left >= wX && pos.top >= wY && oW + pos.left <= wX + wW && oH + pos.top <= wY + wH ){
  16.         //ET ICI TU FAIS TON STATE POUR LA PAGE
  17.       }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement