infinitescroll 通过无限制分页(json方式完整代码)
@{
ViewBag.Title = " ";
}
<style type="text/css">
#infscr-loading {
text-align: center;
z-index: 100;
position: fixed;
left: 45%;
bottom: 40px;
width: 200px;
padding: 10px;
background: #000;
opacity: 0.8;
color: #FFF;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
</style>
<!-- Begin Small Hero Block -->
@*<section class="hero small accent parallax" style="background-image: url(/images/parallax.png); height:30px">*@
<section class="hero small accent parallax">
<!-- Heading -->
<div class="hero-content container">
<!-- <h1>ITSiteBlog.</h1> -->
<div class="jumbotron" style="background:#2db4d8">
<h1><font color="#fff">Hello, world!</font></h1>
<p>记录Java学习过程的点滴!</p>
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
</div>
</div>
<!-- END -->
<!-- Button -->
<div class="sub-hero container">
<!-- <span class="line"></span> -->
</div>
<!-- END -->
</section>
<!-- End Small Hero Block -->
<!-- Begin Blog Block -->
<section class="content container">
<div class="row">
<!-- Begin Posts -->
<div class="col-sm-8">
<!-- Link Post -->
<div id="content">
<h1>Infinite Scroll Testing</h1>
</div>
<a id="next" href="/Home/GetContentList?Catalog=@ViewBag.Catalog¤tPage=2&pageSize=10">next page</a>
</div>
<!-- END -->
<!-- Begin Sidebar -->
<div class="col-sm-4">
<div class="sidebar">
<!-- search widget -->
<div class="widget clearfix">
<form action="#">
<input name="s" id="s" type="text" class="search" placeholder="Search.." value="" />
<input type="submit" value="Go" class="search-submit" />
</form>
</div><!-- END -->
<!-- text widget -->
<div class="widget">
<h5>公告</h5>
<div class="textwidget"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.</p></div>
</div><!-- END -->
<!-- categories widget -->
@if (ViewBag.CatalogList != null && ViewBag.CatalogList.Count > 0)
{
TempData["CatalogList"] = ViewBag.CatalogList;
<div class="widget">
<h5>类别</h5>
<ul>
@for (int i = 0; i < ViewBag.CatalogList.Count; i++)
{
<li class="cat-item"><a href="?Catalog=@ViewBag.CatalogList[i].ID ">@ViewBag.CatalogList[i].Name</a> (3)</li>
}
</ul>
</div><!-- END -->
}
<!-- tagcloud widget -->
<div class="widget">
<h5>标签</h5>
<div class="tagcloud">
<a href='#'>JAVA</a>
<a href='#'>.NET</a>
<a href='#'>云计算</a>
<a href='#'>大数据</a>
<a href='#'>PHP</a>
<a href='#'>数据库</a>
</div>
</div><!-- END -->
<!-- archives widget -->
@*<div class="widget widget-archive">
<h5>点击最多</h5>
<ul>
<li><a href="#">July 2013</a></li>
<li><a href="#">June 2013</a></li>
</ul>
</div>*@<!-- END -->
<!-- recent comments widget -->
<div class="widget widget-recent-comments">
<h5>最新发布</h5>
<ul id="recentcomments">
@for (int i = 0; i < ViewBag.NewContentList.Count; i++)
{
<li class="recentcomments"> <a href="~/Home/article?contentID=@ViewBag.NewContentList[i].ID">@ViewBag.NewContentList[i].Title @ViewBag.NewContentList[i].PostDate </a></li>
}
</ul>
</div><!-- END -->
<!-- recent posts widget -->
<div class="widget widget-recent-entries">
<h5>推荐文章</h5>
<ul>
<li><a href="#" title="Post Title">Standard post with goodies.</a></li>
<li><a href="#" title="Post Title">Fluid video. Yeah we got that.</a></li>
<li><a href="#" title="Post Title">Gallery post with slider.</a></li>
</ul>
</div><!-- END -->
<!-- recent comments widget -->
@*<div class="widget widget-recent-comments">
<h5>最热文章</h5>
<ul id="recentcomments">
<li class="recentcomments">Admin on <a href="#">Standard post with goodies.</a></li>
<li class="recentcomments">Aether-Themes on <a href="#">Fluid video. Yeah we got that.</a></li>
<li class="recentcomments">Admin on <a href="#">Gallery post with slider.</a></li>
</ul>
</div>*@
<!-- END -->
</div>
</div><!-- END -->
</div>
</section>
<!-- End Blog Block -->
<script type="text/javascript">
$(document).ready(function () {
$('#content').infinitescroll({
navSelector: "#next:last",
nextSelector: "a#next:last",
itemSelector: "#content",
debug: true,
extraScrollPx: 20,
dataType: 'json',
loading: {
//加载效果
finishedMsg: 'No more pages to load',
},
maxPage: 3,
template: function (data) {
//data表示服务端返回的json格式数据,这里需要把data转换成瀑布流块的html格式,然后返回给回到函数
var content = '';
for (var i = 0; i < data.Data.length; i++) {
content += ' <div class="post link"> '
+ ' <span class="date">30<br><small>Sep</small></span> '
+ ' <span class="date" style="width:63px;height:63px;padding-bottom:0px;border-bottom:0px">'
+ ' <img src="' + data.Data[i].imgUrl + '" style="width:63px;height:63px;padding:0px;border:0px" width="63" height="63" />'
+ ' </span>'
+ ' <div class="post-title">'
+ ' <h2><a href="/Home/article?ID=' + data.Data[i].ID + '">' + data.Data[i].Title + '</a></h2>'
+ ' <div class="post-meta">'
+ ' <h6> 日期:' + data.Data[i].PostDater + ' 作者:' + data.Data[i].Poster + '</h6>'
+ ' </div>'
+ ' </div>'
+ ' </div> ';
}
}
return content;
}
//,function (newElements) {
// $("#content").prepend(newElements);
//}
);
});
</script>
infinitescroll 通过无限制分页(json方式完整代码)的更多相关文章
- python实现邮件发送完整代码(带附件发送方式)
实例一:利用SMTP与EMAIL实现邮件发送,带附件(完整代码) __author__ = 'Administrator'#coding=gb2312 from email.Header import ...
- Android+struts2+JSON方式的手机开发(Login)
在手机的后台服务无论是调用WebService还是Http请求,多数都是采用Android的HttpClient实现相关的调用实现.本文实现Android+Struts2+JSON方式实现为手机前台提 ...
- 单点登录(十三)-----实战-----cas4.2.X登录启用mongodb验证方式完整流程
我们在之前的文章中中已经讲到了正确部署运行cas server 和 在cas client中配置. 在此基础上 我们去掉了https的验证,启用了http访问的模式. 单点登录(七)-----实战-- ...
- 实战SpringCloud响应式微服务系列教程(第十章)响应式RESTful服务完整代码示例
本文为实战SpringCloud响应式微服务系列教程第十章,本章给出响应式RESTful服务完整代码示例.建议没有之前基础的童鞋,先看之前的章节,章节目录放在文末. 1.搭建响应式RESTful服务. ...
- 使用Express连接mysql详细教程(附项目的完整代码我放在结尾了)
使用Express连接mysql详细教程(附项目的完整代码我放在结尾了) 要使用Express连接本地数据库 我们首先需要安装好Express的依赖 我们使用这个框架呢首先要有一点ajax的基础 如果 ...
- 使用 ServiceStack.Text 序列化 json的实现代码【转】
转自:http://www.jb51.net/article/38338.htm 今天发篇文章总结下自己使用 ServiceStack.Text 来序列化 json.它的速度比 Newtonsoft. ...
- json方式封装接口通信
编写response类: <?php class response{ /** * 按json方式输出通信数据 * @param integer $code 状态码 * @param string ...
- Jquery发送ajax请求以及datatype参数为text/JSON方式
Jquery发送ajax请求以及datatype参数为text/JSON方式 1.方式一:datatype:'text' 2.方式二:datatype:'JSON' 3.使用gson-1.5.jar包 ...
- wemall app商城源码中基于JAVA通过Http请求获取json字符串的代码
wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.分享其中关于通过Http请求获取json字符串的代码供 ...
随机推荐
- session与cookie的关系
客户第一次发送请求给服务器,此时服务器产生一个唯一的sessionID,并返回给客户端(通过cookie),此时的cookie并没有setMaxAge();只是保存于客户端的内存中,并与一个浏览器窗口 ...
- CreateThread函数
当使用CreateProcess调用时,系统将创建一个进程和一个主线程. CreateThread将在主线程的基础上创建一个新线程,大致做例如以下步骤: 1在内核对象中分配一个线程标识/句柄,可供管理 ...
- DLL程序的创建步骤和測试程序
首先,创建DLL程序 然后,加入一个导出类 比如: //Test.h #pragma once class AFX_EXT_CLASS Test { public: Test(void); ~Te ...
- [ES6] Array.find()
Convenient method to find one item in an array, avoid writing and for + if: let arys = [1,,5,,6] ; ...
- (转) Unity3D中角色的动画脚本的编写(三)
在上一篇,我们具体的讲解了有关动画的融合,也提到了有关动画状态的权重问题.那么这次,我来以一个例子的形式来向大家讲解动画的叠加,或许会涉及到多方面的知识,我力求一次讲清.好了,我们开始吧! 首先我们必 ...
- C#读取Word文档内容代码
首先要添加引用com组件:然后引用: using Word = Microsoft.Office.Interop.Word; 获取内容: /// /// 读取 word文档 返回内容 /// //// ...
- Gson解析json数据(转)
一. www.json.org这是JSON的官方网站. 首先,我,我们需要在code.google.com/p/google-gson/downloads/list下载JSON的jar包,解析后把gs ...
- Android Studio学习随笔-模拟耗时操作(sleep)
在这里我申明一点,因为我是挂着VPN去YOUTOBE看的尚学堂的高明鑫老师讲的Android基础学习视频,有些东西他没有讲,而我也没办法,只能等两个星期后学校请老师来的时候进行询问,当然我也会将一些问 ...
- 将datagrid中数据导出到excel中 -------<<工作日志2014-6-6>>
前台datagrid数据绑定 #region 导出到excel中 /// <summary> /// 2014-6-6 /// </summary> / ...
- document.all用法
document.all用法 一. document.all是页面内所有元素的一个集合.例如: document.all(0)表示页面内第一个元素二.document.all可以判断浏览器 ...