Forum moderator: bigblog |
uCoz Community For Webmasters Custom Solutions New page auto load when scrolling down |
New page auto load when scrolling down |
At last i got it working. Thanks a lot to Jackson Mihailov who created this script. Although, Sunny tried to help me a lot. She came along with one solution but it wasn't that appropriate as this is. Thanks anyway.
So those who want this great script check this. Just download the javascript. Upload it in your file manager. Replace $BODY$ with the code shown. <script src="link to script JMpagesList "></script> put the .js link here. Check it working here. Good luck everyone! Post edited by FOF - Sunday, 2013-10-06, 6:26 PM
|
FOF, i have some problems with that script
on this site: in the file catalog module, the script opens only two pages ("/load/0-2" and "/load/0-3") and after that he stops opening next pages. but on this site in the same module as in the above site, the script worsk fine. Another problem is with the photo module, i tried to put the script on the first page of the photo module (on both sites) and it didin't work. My questions are: Why on my first site, the script loads only two pages? How can i make the script work in the first page of photo module? How can i make my share buttons work in the loaded pages? Added (2013-10-14, 2:54 PM) |
FOF, ok .
Added (2013-11-19, 6:56 AM) --------------------------------------------- Any news? Added (2014-01-29, 10:41 AM) --------------------------------------------- I still don't know why this script does not work correctly on my website. When i scroll down on photo module(/photo/1/) the script adds 2 times the number of entries from the first page. Can someone who's good at javascript please help me? Script source Website where the script works http://tavaidienai.ucoz.com/js/JMpagesListSpecEditionAlbumOnly.js http://tavaidienai.ucoz.com/js/pageautoload.js I tried to contact FOF, but he didn't answer. Post edited by Mar1aN - Sunday, 2014-02-02, 11:50 PM
|
I dont know if uCoz will launch this feature. Hope to see it in the near future.
|
Anybody with this script lets negotiate a price
Systems developer
|
Soldierdevil, I'm not the owner of this code. According to sunny(the owner of the code) you must change the $BODY$ of you page with this code.
Code <span class="lenta">$BODY$</span> <div id="ShowMore" pagenum="1"></div> <div id="more1"></div> <script type="text/javascript"> $(window).scroll(function(){ if ($(document).height() - $(window).height() <= $(window).scrollTop() + 50) { var $showclick = $('#ShowMore' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .attr('pagenum' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ; $('#more'+$showclick).after('<div id="more'+(parseInt($showclick)+1)+'"></div>' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ; $showclick++; $('#more'+$showclick).load('$MODULE_URL$0'+'-'+$showclick+' .lenta' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ; $('#ShowMore' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .attr('pagenum',parseInt($showclick)); return false; } } <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> </script> 1F4BF3B
|
Cyberdasm, have used this code before and never worked. Wish i would get the right one. Its the only component lacking on my site to be perfect but all i tried are not compatible with ucoz system
Systems developer
|
Soldierdevil, Cyberdasm, few corrections:
Code <span class="lenta">$BODY$</span> <div id="ShowMore" pagenum="1"></div> <div id="more1"></div> <script type="text/javascript"> $(window).scroll(function(){ if ($(document).height() - $(window).height() <= $(window).scrollTop() + 50) { var $showclick = $('#ShowMore').attr('pagenum'); $('#more'+$showclick).after('<div id="more'+(parseInt($showclick)+1)+'"></div>'); $showclick++; $('#more'+$showclick).load('$MODULE_URL$0'+'-'+$showclick+' .lenta'); $('#ShowMore').attr('pagenum',parseInt($showclick)); return false; } };); </script> hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau sometimes i lurk here |
bigblog, i really love this code but dont know how to get around with it. I pasted everything i see to the video module but nothing happens.
Systems developer
|
Same here... but I try my best to make it work. heheh Still it don't run.
If I'm not mistaken this script has a function to click show more. Added (2016-11-30, 6:51 AM) Code <script> var track_page = 1; //track user click as page number, right now page number is 1 load_contents(track_page); //load content $("#load_more_button").click(function (e) { //user clicks on button track_page++; //page number increment everytime user clicks load button load_contents(track_page); //load content }); //Ajax load function function load_contents(track_page){ $('.animation_image' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .show(); //show loading image $.post( 'fetch_pages.php', {'page': track_page}, function(data){ if(data.trim().length == 0){ //display text and disable load button if nothing to load $("#load_more_button").text("No more records!").prop("disabled", true); } $("#results").append(data); //append data into #results element //scroll page to button element $("html, body").animate({scrollTop: $("#load_more_button").offset().top}, 800); //hide loading image $('.animation_image' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .hide(); //hide loading image once data is received }); } </script> 1F4BF3B
|
Cyberdasm, the script you're using is requesting data from a PHP script.
Code $.post( 'fetch_pages.php', {'page': track_page}, function(data){ You need to either write a PHP script to handle the post request, or go back and have a look at the script bigblog posted earlier. Jack of all trades in development, design, strategy.
Working as a Support Engineer. Been here for 13 years and counting. |
| |||