如何在Jscroll中的分页之前添加自定义类

时间:2019-01-05 06:36:36

标签: php jquery laravel infinite-scroll jquery-jscroll

我的项目遇到了问题。我想在项目中添加无限滚动。在这种情况下,当我在nextSelector中的分页之前添加一个类/ id时,错误提示为route is not defined

jQuery('.tab-pane-infinitescroll.active ul.pagination').hide();
jQuery(function() {
    jQuery('.tab-pane-infinitescroll.active .scroll').jscroll({
        autoTrigger: true,
        nextSelector: '.pagination li.active + li a',
        contentSelector: '.tab-pane-infinitescroll.active div.scroll',
        callback: function() {
            jQuery('.tab-pane-infinitescroll.active ul.pagination').remove();
        }
    });

    jQuery('.tab-pane-infinitescroll.active .scroll').removeClass('jscroll_added');
    jQuery('.tab-pane-infinitescroll.active .scroll').addClass('jscroll_added');
});

此代码运行完美。但是当我使用这段代码

jQuery('.tab-pane-infinitescroll.active ul.pagination').hide();
jQuery(function() {
    jQuery('.tab-pane-infinitescroll.active .scroll').jscroll({
        autoTrigger: true,
        nextSelector: '.tab-pane-infinitescroll.active .pagination li.active + li a',
        contentSelector: '.tab-pane-infinitescroll.active div.scroll',
        callback: function() {
            jQuery('.tab-pane-infinitescroll.active ul.pagination').remove();
        }
    });

    jQuery('.tab-pane-infinitescroll.active .scroll').removeClass('jscroll_added');
    jQuery('.tab-pane-infinitescroll.active .scroll').addClass('jscroll_added');
});

此代码无效。这是我的刀片div

<div class="tab-pane tab-pane-infinitescroll active" id="Public">
    <div class="scroll">
        @foreach($publics as $public)
        <div class="post-block">
            <div class="post-inner">
                <a href="{{ route('user.show', [$user->id, Helper::slugUrl($user->name)]) }}">
                    <div class="post-author">
                        <div class="author-info">
                            <h4>{{ $user->name }}</h4>
                            <p>{{ $user->bio }}</p>
                        </div>
                    </div>
                </a>>
            </div>
        </div>
        @endforeach
        {{ $publics->appends('public_page')->links() }}
    </div>
</div>

预先感谢

0 个答案:

没有答案