【问题标题】:jquery waypoint add element only the first timejquery waypoint仅第一次添加元素
【发布时间】:2015-01-12 18:45:15
【问题描述】:

我想用 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%'
    });

【问题讨论】:

    标签: jquery jquery-waypoints jquery-pagination


    【解决方案1】:

    解决了。 添加 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%'
        });

    【讨论】:

      猜你喜欢
      • 2016-11-03
      • 1970-01-01
      • 2021-12-08
      • 2017-05-04
      • 1970-01-01
      • 2019-10-30
      • 1970-01-01
      • 2011-10-22
      • 2013-01-11
      相关资源
      最近更新 更多