我想用jquery和ajax请求进行一个路标分页。我第一次添加正确,但随后添加更多内容必须在滚动上下移动
这是我的HTML
<div id="lista_planes" class="span_of_4">
<div class="col-md-3 span1_of_4">
<div class="col-md-3 span1_of_4">
<div class="col-md-3 span1_of_4">
<div class="col-md-3 span1_of_4">
</div>
这是我的Js
var pagina = 2;
var hayMasPlanes = true;
var opts = {
offset: '100%'
};
$('#verMas').waypoint({
handler: function(direction){
if(direction == 'down'){
$.get('<?php echo Router::url(array('action' => 'ajaxPlanes')) ?>/' + pagina, '',
function (dato) {
if(dato == ''){
$('#verMas').hide();
}
pagina++;
$('#lista_planes').append(dato);
}
);
}},
offset: '50%'
});
&#13;
答案 0 :(得分:1)
Solveeed。 添加Waypoint.refreshAll();在ajax请求中
$('#verMas').waypoint({
handler: function(direction){
if(direction == 'down'){
$.get('<?php echo Router::url(array('action' => 'ajaxPlanes')) ?>/' + pagina, '',
function (dato) {
if(dato == ''){
$('#verMas').hide();
}
pagina++;
$('#lista_planes').append(dato);
Waypoint.refreshAll();
}
);
}},
offset: '50%'
});
&#13;