Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- componentDidMount(){
- window.addEventListener('scroll', this.checkIfBottom());
- }
- componentWillUnmount() {
- window.removeEventListener('scroll', this.checkIfBottom());
- }
- checkIfBottom(){
- var thatElement = $('#repereBottom')
- var pos = thatElement.offset(),
- wX = $(window).scrollLeft(), wY = $(window).scrollTop(),
- wH = $(window).height(), wW = $(window).width(),
- oH = thatElement.outerHeight(), oW = thatElement.outerWidth();
- if (pos.left >= wX && pos.top >= wY && oW + pos.left <= wX + wW && oH + pos.top <= wY + wH ){
- //ET ICI TU FAIS TON STATE POUR LA PAGE
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement