郭彦宏
2017-10-14 21:33
var options = {
dataSource: sources,
className: 'paginationjs-theme-blue',
callback: function(response, pagination){
//window.console && console.log(response, pagination);
var dataHtml = '<ul class="course-list">';
$.each(response, function(index, item){
dataHtml += '<li class="item">'+
'<div class="media">'+
'<div class="media-left">'+
'<a href="#">'+
' <img class="media-object" src="images/avatar.jpg" alt="头像">'+
'</a>'+
'</div>'+
'<div class="media-body">'+
' <h4 class="media-heading">夜照天星</h4>'+
'<p>'+response[index].recordNotes+'</p>'+
' <p class="time clearfix"><span>'+response[index].recordTime+'</span><a href="comment.html" style="visibility:'+show+'!important"><span class="count"></span>回答</a><a href="comment.html" style="visibility:'+show+'!important"><span class="view"></span>浏览</a></p>'+
'</div>'+
'</div>'+
'</li>';
});
dataHtml += '</ul>';
container.prev().html(dataHtml);
},
pageSize: num
};
var coun=null;
$(function(){
//分页
function createDemo(name,show,num){
var container = $('#pagination-' + name);
var result=null;
var sources = function(){
$.ajax({
url: '/secondClass/deskVedio/nodesAll',
type: 'POST',
dataType: 'json',
async:false,
success: function(data) {
result=data.notes;
}
})
return result;
}();
var options = {
dataSource: sources,
className: 'paginationjs-theme-blue',
callback: function(response, pagination){
//window.console && console.log(response, pagination);
var dataHtml = '<ul class="course-list">';
$.each(response, function(index, item){
dataHtml += '<li class="item">'+
'<div class="media">'+
'<div class="media-left">'+
'<a href="#">'+
' <img class="media-object" src="images/avatar.jpg" alt="头像">'+
'</a>'+
'</div>'+
'<div class="media-body">'+
' <h4 class="media-heading">夜照天星</h4>'+
'<p>'+response[index].recordNotes+'</p>'+
' <p class="time clearfix"><span>'+response[index].recordTime+'</span><a href="comment.html" style="visibility:'+show+'!important"><span class="count"></span>回答</a><a href="comment.html" style="visibility:'+show+'!important"><span class="view"></span>浏览</a></p>'+
'</div>'+
'</div>'+
'</li>';
});
dataHtml += '</ul>';
container.prev().html(dataHtml);
},
pageSize: num
};
//$.pagination(container, options);
container.addHook('beforeInit', function(){
// window.console && console.log('beforeInit...');
});
container.pagination(options);
container.addHook('beforePageOnClick', function(){
// window.console && console.log('beforePageOnClick...');
//return false
});
return container;
}
createDemo('pages','hidden',5);
createDemo('page','visible',5);
});
Redis入门
107159 学习 · 154 问题
相似问题