php - Generate more articles as user scrolls -


i building website allow users upload images, gifs, , videos. on home page want have list of files people have uploaded, preferably based on popularity i'm not far along yet. when page first loads, want have number of files being shown, based on users screen resolution. user can scroll down little before more files loaded. code right this:

<article class="item thumb" data-width="282">      <h2><?php echo $file_title;?></h2>      <a href="<?php echo $randomimage ?>"><img src="<?php echo $randomimage ?>" alt=""></a> </article> <article class="item thumb" data-width="384">      <h2><?php echo $file_title;?></h2>      <a href="<?php echo $randomimage ?>"><img src="<?php echo $randomimage ?>" alt=""></a> </article> 

it total of 8 times. how can make page request more tags user scrolls over...just facebook loads more content scroll down? sorry if i'm not explaining well.

you should @ window.onscroll event, here can hook @ function called when scrolls window on page. can decision if more content needs loaded.

as mdn has documentation on this. check out https://developer.mozilla.org/en-us/docs/web/api/window.onscroll


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -