雨哲插件

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
雨哲插件 资料库 超强嵌入点扩展组件 门户分类页面自动载入分页
  • 全部资料
  • 查看资料

门户分类页面自动载入分页

2018-4-23 17:40|分类: 超强嵌入点扩展组件 |发布用户: 雨哲

201804/23/174011s9ceaoejqjj2cj92.jpg

自动载入分页,方便用户浏览。

组件名称:门户 列表 自动加载

组件变量:ad_articlelist@autoload

手机嵌入:否

组件类型:string

模板内容:

{hookinput:thispageset,,,hidden}noedit{/hookinput}[yuzhehook:code_getresult_login_after]
$this->autoload['show'] = 0;
if ($param['params'][2] == 3){
    $this->autoload['adcontent'] = $param[content] ? $param[content] : '';
    $this->autoload['show'] = 1;
}
[/yuzhehook:code_getresult_login_after]<!--{if $this->autoload['show']}-->
[yuzhehook:writecss]
/** portal::list **/
.pgbtn { margin: 5px 0 10px; }
.pgbtn a { display: block; height: 40px; line-height: 40px; letter-spacing: 5px; text-align: center; border: 1px solid #DCDCDC; background: #F5F5F5; font-size: 14px; outline: 
none; border-radius: 5px; box-shadow: 0 1px 0 #F5F5F5; }
.pgbtn a:hover { border-color: #BABABA; text-decoration: none; }
.pgbtn a:active { background: #EEE; border-color: #D0D0D0; box-shadow: none; }
/** end **/
[/yuzhehook:writecss]
<div id="pgbtn" class="pgbtn mbm"></div>
<script type="text/javascript">
jQuery(document).ready(function() {
    var scrolltimer = null,
    page = {echo $_G['page']},
    usenextpage = jQuery("a.nxt").text(),
    loadtext = '<a href="{url}" hidefocus="true"><img src="./static/image/common/loading.gif" alt="" width="16" height="16" class="vm" /> 加载中...',
    loadnexttext = '<a href="{url}" hidefocus="true">下一页 &raquo;</a>',    
    loadendtext = '<a href="{url}">加载完成 返回首页 &raquo;</a>',
    pgbtn = jQuery("#pgbtn"),
    url = window.location.href;
    loadingpoint = jQuery(document).height() - pgbtn.offset().top;//载入点距页面底部高度 - pgbtn.height()
    if (url.indexOf("page=") != -1){
        url = url.substring(0, url.indexOf("page="))+'page='
    }else{
        url += (url.indexOf("?") == -1 ? '?' : '&')+'page='
    }
    pgbtn.html(loadnexttext.replace("{url}", url+(page+1)));
    jQuery(window).scroll(function() {
        if (scrolltimer == null) {
            scrolltimer = setTimeout(function() {
                try {
                    /*判断窗体高度与竖向滚动位移大小相加 是否 超过内容页高度*/
                    if (usenextpage && (jQuery(window).height() + jQuery(window).scrollTop()) + loadingpoint >= jQuery(document).height()) {
                        page++;
                        pgbtn.html(loadtext.replace("{url}", url+page));
                        var htmlobj = jQuery.ajax({url:url+page,async:false});
                        var gethtml = htmlobj.responseText;
                        gethtml = gethtml.replace(/\n|\r/g, "");
                        if (gethtml.indexOf("<dl class=\"bbda cl\">") != -1) {
                            var s = gethtml.substring(gethtml.indexOf("<dl class=\"bbda cl\">"), gethtml.indexOf("[diy=listloopbottom]"));
                            s = s.substring(0, s.lastIndexOf("</div>"));
                            jQuery("div.xld").append('<dl class="bbda cl pgbtn"><a href="'+url+page+'" class="mbn">第 '+page+' 页</a></dl>'+s);
                            var p = gethtml.substring(gethtml.lastIndexOf("<div class=\"pg\">"), gethtml.lastIndexOf("[diy=diycontentbottom]"));
                            p = p.replace("<div class=\"pg\">", "");
                            p = p.substring(0, p.lastIndexOf("</div>"));
                            jQuery("div.pg").html(p);
                            if (p.indexOf("class=\"nxt\"") == -1){
                                usenextpage = null;
                            }
                            pgbtn.html(loadnexttext.replace("{url}", url+(page+1)));
                        }
                    }else if(!usenextpage && loadendtext){
                        pgbtn.html(loadendtext.replace("{url}", url+"1"));
                    }
                } catch(e) {}
                scrolltimer = null;
            }, 320);
        }
    });
});   
</script>{echo $this->autoload['adcontent']}<!--{/if}-->

插件介绍:雨哲超强嵌入点 插件是一款平台插件,通过后台添加在前台显示(基于模板的hook位置)指定内容的功能。

下载地址:http://addon.discuz.com/?@yuzhe_hook.plugin

分享到: 手机访问 分享给QQ好友 分享到QQ 分享到QQ空间 QQ空间 分享到新浪微博 新浪微博 分享到人人 人人网
企业微信 : 雨哲手机扫描添加到联系人手机扫描直接访问

QQ|关于我们|Archiver|手机版|小黑屋|雨哲插件

GMT+8, 2024-5-20 19:52 , Processed in 0.432036 second(s), 9 queries , Xcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回顶部