加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

javascript 将 ThinkPHP 分页自动转换为 bootstrap 分页

发布时间:2020-12-13 20:21:23 所属栏目:PHP教程 来源:网络整理
导读:#写的一个通用的,将thinkphp生成的分页HTML,自动转换为 bootstrap 分页: /** * @author default7#zbphp.com * @description 将ThinkPHP的分页转换为 bootstrap分页 * @param selector */function initPagination(selector) { selector = selector || .pag

#写的一个通用的,将thinkphp生成的分页HTML,自动转换为 bootstrap 分页:

/** * @author default7#zbphp.com * @description 将ThinkPHP的分页转换为 bootstrap分页 * @param selector */ function initPagination(selector) { selector = selector || '.page'; $(selector).each(function (i,o) { var html = '<ul class="pagination">'; $(o).find('a,span').each(function (i2,o2) { var linkHtml = ''; if ($(o2).is('a')) { linkHtml = '<a href="' + ($(o2).attr('href') || '#') + '">' + $(o2).text() + '</a>'; } else if ($(o2).is('span')) { linkHtml = '<a>' + $(o2).text() + '</a>'; } var css = ''; if ($(o2).hasClass('current')) { css = ' class="active" '; } html += '<li' + css + '>' + linkHtml + '</li>'; }); html += '</ul>'; $(o).html(html).fadeIn(); }); }


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读