rogerjose
(Rogerjose81)
1
Hello Yii-Users 
I want to build a web page which have a feature for autoscroll the page's content.
It's, as far the user uses the scroll, then the page will automatically adds new content to the page.
Something like dzone.com
Is in Yii a component which allows to do this?
Otherwise, Do you know a third-party library/plugin to do this?
Thanks in advance.
mocapapa
(Mocapapa)
2
Looking the source of that site, it is done by jQuery such as,
(1) jQuery.scroll if scroll condition is met (e.g. scroll bar getting low); load flag = true;
(2) jQuery.ajax (get the data from the host) if load flag = true;
You may do the same using only jQuery, I think.
Hope this helps 
Maxximus
(Maxximus007)
3
I do something similar, perhaps you can use this (in the view):
<div id='commentLoader'></div>
<script>
$(document).ready(function() {
var lastcomment;
function commentFunc()
{
if (lastcomment != $(".comments:last").attr("id")){
$('div#commentLoader').html('<img src="/assets/img/loading.gif">');
$.ajax({
mode: "abort",
// limit abortion to this input
port: "comments",
url: "/vote/next/"+$(".comments:last").attr("id"),
data: '',
success:
function(data){
if (data != "End reached..") {
$(".comments:last").after(data);
}
$('div#commentLoader').empty();
}
});
}
lastcomment = $(".comments:last").attr("id");
};
$(window).scroll(function(){
if ($('div#commentLoader').offset()) {
if ($(window).scrollTop() > $('div#commentLoader').offset()['top'] - 450){
commentFunc();
}
}
});
});
</script>
Be sure to use ajaxqueue. When the Ajax request sends a "End reached…" I clear the commentLoader div, so it stops sending requests.