Infinite Scrolling twitter style using jQuery's plugin
I am 开发者_如何学Ctrying to use jQuery's plugin so as to achieve a twitter sort of scrolling; meaning that when i reach the bottom, by clicking a button the next page is loaded. I have the basic code added:
$('#content').infinitescroll({
navSelector : "div.navigation",
nextSelector : "div.navigation a:first",
itemSelector : "#content div.message"
});
When my page loads, the previous script is executed. This is my view code, where each item that would be a "post", is of class "message".
foreach($messages as $post): ?>
<div class="message" style="margin-top:10px;">
<?php
if ($post->parent_message_id==null){
$this->renderPartial('_messageView',array(
'data'=>$post,
'ligaId'=>$model->id,
));
}
?>
</div>
<?php
endforeach; ?>
I have really no idea how to implement this... how to use this extension. Anybody has used it?
精彩评论