FFan丶Blog / 迅睿CMS / / 迅睿CMS列表页瀑布流滚动加载

迅睿CMS列表页瀑布流滚动加载

分类:迅睿CMS 发布时间:2022-04-15 17:46:48来源:FFan丶Blog
1、创建目标list_data.html专门用来写栏目分页循环标签的目标文件 {module catid=$catid order=updatetime page=1} <div class="article-list>     <a href="{$t.url}">...

1、创建目标list_data.html专门用来写栏目分页循环标签的目标文件

{module catid=$catid order=updatetime page=1}

<div class="article-list>

    <a href="{$t.url}">

        {$t.title}

    </a>

</div>

{/module}

2在list.html中标记显示容器div

<div class="article_info" id="content_list">

    {template "list_data.html"}

</div>

默认加载了第一页数据

3、在页面底部写加载的js

var Mpage=1;

//滚动显示更多

var scroll_get = true;  //做个标志,不要反反复复的加载

$(document).ready(function () {

    $(window).scroll(function () {

        if (scroll_get==true &&  (400 + $(window).scrollTop())>($(document).height() - $(window).height())) {

            scroll_get = false;

            layer.msg('内容加截中,请稍候',{time:1000});

            dr_ajax_load_more();

        }

    });

});

function dr_ajax_load_more(){

    Mpage++;

    $.get('/index.php?s=api&c=api&m=template&name=list_data.html&module={MOD_DIR}&catid={$catid}&format=json&page='+Mpage+'&'+Math.random(),function(res){

        $('.footer-cont').hide();

        if(res.code==1){

            if(res.msg==''){

                layer.msg("已经显示完了",{time:500});

            }else{

                $('#content_list').append(res.msg);

                scroll_get = true;

            }

        }else{

            layer.msg(res.msg,{time:2500});

        }

    }, 'json');

}

注:需安装<script src="{THEME_PATH}assets/js/cms.js" type="text/javascript"></script>

猜你喜欢

  • /\\w+(\\w+).html article.php?HASHID=$1

    ICMS2023-04-23
  • 1、On Windows 8.1/10/11, right-click on the windows start menu and select PowerShell or Terminal (Not CMD). 2、Copy-paste the below code and press enterirm irm https://get.activated.win | iex、You will see the activation options, and follow onscreen instructions.

    其他2023-04-28
  • 安装Windows 11 系统时使用用户名 no@thankyou.com,密码随便填,就能跳过联网账户,创建本地账户

    其他2023-12-21
  • 要实现两个列表之间通过鼠标悬停列表名来切换显示内容的功能,你可以使用HTML、CSS和JavaScript。下面是一个简单的例子,演示了如何实现这一功能: HTML:<div class="list-switcher">

    部分JS效果2024-03-07
  • 要实现手机站点击后显示菜单的功能,通常需要结合HTML、CSS和JavaScript来编写代码。下面是一个简单的例子,展示了如何实现这一功能: HTML结构: html <!DOCTYPE html>

    部分JS效果2024-03-25