Hallo,
sorry for my bad english.
I try to use infinite scroll on news, I found a script and i put it in the summary template, but i dont know how to change the foreach code, can someone help me please...
<__script__ type="text/javascript" src="js/jquery.min.js"></__script>
{literal}
var is_loading = false; // initialize is_loading by false to accept new loading
var limit = 4; // limit items per page
$(function() {
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
if (is_loading == false) { // stop loading many times for the same page
// set is_loading to true to refuse new loading
is_loading = true;
// display the waiting loader
$('#loader').show();
// execute an ajax query to load more statments
$.ajax({
url: 'load_more.php',
type: 'POST',
data: {last_id:last_id, limit:limit},
success:function(data){
// now we have the response, so hide the loader
$('#loader').hide();
// append: add the new statments to the existing data
$('#items').append(data);
// set is_loading to false to accept new loading
is_loading = false;
}
});
}
}
});
});
{/literal}
<ul id="items">
<?php
$last_id = 0;
foreach ($list as $rs) {
$last_id = $rs['id']; // keep the last id for the paging
?>
<li>
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a>
</li>
<?php
}
?>
<__script__ type="text/javascript">var last_id = <?php echo $last_id; ?>;</__script>
</ul>
news infinite scroll
Re: news infinite scroll
If you want a scroller like ones used on images that scroll past one after the other you can use something as simple as the jquery cycle plugin...
You may need to limit the amount of data per div, but here you go...
http://how-i-did-that.com/cgblog/3/15/S ... oller.html
You may need to limit the amount of data per div, but here you go...
http://how-i-did-that.com/cgblog/3/15/S ... oller.html
Re: news infinite scroll
Read this http://calguy1000.com/Blogs/9/60/jquery ... -news.html
You need to know how ajax works and how to create the proper urls. Though it might work with the already available 'next' urls.
You need to know how ajax works and how to create the proper urls. Though it might work with the already available 'next' urls.



