说一下加载更多怎么弄的

其实非常简单

		<script type="text/javascript">
			//点击加载更多
			jQuery(document).ready(function($) {
				//点击下一页的链接(即那个a标签)
				$('.next').click(function() {
					$this = $(this);
					$this.addClass('loading').text('='); //给a标签加载一个loading的class属性,用来添加加载效果
					var href = $this.attr('href'); //获取下一页的链接地址
					if (href != undefined) { //如果地址存在
						$.ajax({ //发起ajax请求
							url: href,
							//请求的地址就是下一页的链接
							type: 'get',
							//请求类型是get
							error: function(request) {
								//如果发生错误怎么处理
							},
							success: function(data) { //请求成功
								$this.removeClass('loading').text('+'); //移除loading属性
								var $res = $(data).find('.l-list'); //从数据中挑出文章数据,请根据实际情况更改
								$('.mdui-list').append($res.fadeIn(500)); //将数据加载加进posts-loop的标签中。
								var newhref = $(data).find('.next').attr('href'); //找出新的下一页链接
								if (newhref != undefined) {
									$('.next').attr('href', newhref);
								} else {
									$('.next').remove(); //如果没有下一页了,隐藏
								}
							}
						});
					}
					return false;
				});
			});
			</script>

上面都有注释的

还用jq呢  2022了

sb
引用
还用jq呢 2022了
sb 还用jq呢 2022了

那2022该用啥了呢?

sb
引用
还用jq呢 2022了
sb 还用jq呢 2022了

会什么就用什么,不会就只能抄作业了

听风飞雪
引用
sb还用jq呢 2022了 会什么就用什么,不会就只能抄作业了
听风飞雪 会什么就用什么,不会就只能抄作业了

php is the best language(

sb
引用
还用jq呢 2022了
sb 还用jq呢 2022了

这个我前台扒到我电脑里倒是没效果也不知道那一步错了,再试试看

虽然我没做过,但是不用说我也知道:AJAX异步加载然后通过JavaScript操作html弄上去就行了。

和websocket做的网页聊天室原理差不多,只不过websocket是被动接收之后加载上去的

听风飞雪
引用
sb还用jq呢 2022了 这个我前台扒到我电脑里倒是没效果也不知道那一步错了,再试试看
听风飞雪 这个我前台扒到我电脑里倒是没效果也不知道那一步错了,再试试看

改一下括号里的值

我也准备抄一个[em_3]

CF
引用
我也准备抄一个[em_3]
CF 我也准备抄一个[em_3]

把他改进一下让他可以自动加载

我也不喜欢自动

CF
引用
我也不喜欢自动
CF 我也不喜欢自动

你搞好没有

<?php include _include(APP_PATH.'view/htm/header.inc.htm');?>

<!--{hook index_start.htm}-->

<div class="row">
	<div class="col-lg-9 main">
		<!--{hook index_main_start.htm}-->
		<div class="card card-threadlist">
			<div class="card-header">
				<ul class="nav nav-tabs card-header-tabs">
					<li class="nav-item">
						<a class="nav-link <?php echo $active == 'default' ? 'active' : '';?>" href="./<?php echo url("$route");?>"><?php echo lang('new_thread');?></a>
					</li>
					<!--{hook index_thread_list_nav_item_after.htm}-->
				</ul>
			</div>
				
			<div class="card-body">
				<ul class="list-unstyled threadlist mb-0">
					<!--{hook index_threadlist_before.htm}-->
					<?php include _include(APP_PATH.'view/htm/thread_list.inc.htm');?>
					<!--{hook index_threadlist_after.htm}-->
				</ul>
			</div>
		</div>
		
		
		<?php include _include(APP_PATH.'view/htm/thread_list_mod.inc.htm');?>
				<a class="next mdui-btn mdui-list-item-avatar " href="????????????????">+</a>
		<!--{hook index_page_before.htm}-->
		<nav  class="my-3"><ul class="pagination justify-content-center flex-wrap"><?php echo $pagination; ?></ul></nav>
		<!--{hook index_page_end.htm}-->
		<script type="text/javascript">
					//点击加载更多
					jQuery(document).ready(function($) {
						//点击下一页的链接(即那个a标签)
						$('.next').click(function() {
							$this = $(this);
							$this.addClass('loading').text('='); //给a标签加载一个loading的class属性,用来添加加载效果
							var href = $this.attr('href'); //获取下一页的链接地址
							if (href != undefined) { //如果地址存在
								$.ajax({ //发起ajax请求
									url: href,
									//请求的地址就是下一页的链接
									type: 'get',
									//请求类型是get
									error: function(request) {
										//如果发生错误怎么处理
									},
									success: function(data) { //请求成功
										$this.removeClass('loading').text('+'); //移除loading属性
										var $res = $(data).find('.l-list'); //从数据中挑出文章数据,请根据实际情况更改
										$('.mdui-list').append($res.fadeIn(500)); //将数据加载加进posts-loop的标签中。
										var newhref = $(data).find('.next').attr('href'); //找出新的下一页链接
										if (newhref != undefined) {
											$('.next').attr('href', newhref);
										} else {
											$('.next').remove(); //如果没有下一页了,隐藏
										}
									}
								});
							}
							return false;
						});
					});
		</script>
		
	</div>
	<div class="col-lg-3 d-none d-lg-block aside">
		<a role="button" class="btn btn-primary btn-block mb-3" href="<?php echo url('thread-create-'.$fid);?>"><?php echo lang('thread_create_new');?></a>
		<!--{hook index_site_brief_before.htm}-->
		<div class="card card-site-info">
			<!--{hook index_site_brief_start.htm}-->
			<div class="m-3">
				<h5 class="text-center"><?php echo $conf['sitename'];?></h5>
				<div class="small line-height-3"><?php echo $conf['sitebrief'];?></div>
			</div>
			<div class="card-footer p-2">
				<table class="w-100 small">
					<tr align="center">
						<td>
							<span class="text-muted"><?php echo lang('threads');?></span><br>
							<b><?php echo $runtime['threads'];?></b>
						</td>
						<td>
							<span class="text-muted"><?php echo lang('posts');?></span><br>
							<b><?php echo $runtime['posts'];?></b>
						</td>
						<td>
							<span class="text-muted"><?php echo lang('users');?></span><br>
							<b><?php echo $runtime['users'];?></b>
						</td>
						<?php if($runtime['onlines'] > 0) { ?>
						<td>
							<span class="text-muted"><?php echo lang('online');?></span><br>
							<b><?php echo $runtime['onlines'];?></b>
						</td>
						<?php } ?>
					</tr>
				</table>
			</div>
			<!--{hook index_site_brief_end.htm}-->
		</div>
		<!--{hook index_site_brief_after.htm}-->
	</div>
</div>

<!--{hook index_end.htm}-->

<?php include _include(APP_PATH.'view/htm/footer.inc.htm');?>

<script>
$('li[data-active="fid-0"]').addClass('active');
</script>

<!--{hook index_js.htm}-->

指导一下

听风飞雪
引用
CF我也不喜欢自动 你搞好没有
听风飞雪 你搞好没有

我都没有开始研究呢,你都搞出这么多代码了

提示:不能与JSON API同时使用

1