Advertisement
Guest User

Untitled

a guest
May 30th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. $(document).on('click', 'section.sets a.ajax', function() {
  2. var href = $(this).attr('href');
  3. $.ajax({
  4. url: href,
  5. success: function(data){
  6. console.log(data);
  7. $('section.sets div.items').append($(data).find('section.sets div.items').html());
  8. var href = $(data).find('section.sets a.ajax').attr('href');
  9. $('section.sets a.ajax').attr('href', href);
  10. $(window).on('scroll', onScroll);
  11. }
  12. });
  13. history.pushState({}, '', '/lookbook/');
  14. return false;
  15. });
  16. function onScroll(){
  17. if($(window).scrollTop() + $(window).height() > $(document).height() - 200) {
  18. $(window).off('scroll');
  19. $('section.sets a.ajax').trigger('click');
  20. }
  21. }
  22. $(window).scroll(onScroll);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement