View on GitHub

Heap-infinite-scroll

Download this project as a .zip file Download this project as a tar.gz file

Example scroll to the outside scrollbar


          jQuery(function() {

              var search = new HeapGoogleSearch(),
                  btnClick = function() {
                      search.setQuery($('#search-word').val());
                      scroll.load();
                  },
                  scroll = new HeapInfiniteScroll('.images-panel', {
                      margin: 10,
                      height: 150,
                      downloadIcon: '<i class="fa fa-refresh fa-spin"></i>',
                      scrollbar: '.image-panel',
                      url: search,
                      oncallback: function(itm) {
                          return {
                              description: '<a href="' +
                                  itm.url + '" target="_blank">' +
                                  itm.visibleUrl + '</a><br>' + itm.content
                          };
                      },
                      onclick: function(itm) {
                          var wrapper = $('.image-panel').children('.wrapper');

                          wrapper.html(
                              '<div style="opacity: 0;"><img src="' + itm.url +
                                  '" /><div class="description">' +
                                  itm.description + '</div></div>'
                          );

                          wrapper.children('div').animate({
                              opacity: 1
                          }, 'fast');
                        }
                    });

              $('#search-button').click(btnClick);

              setTimeout(function() {
                  btnClick();
              }, 1000);

          });
          

© Vladimir Neginskiy 2015