|
示范说明:翻页内容居中对齐,背景灰色
.Pagination{ display:block; clear:both; text-align:center; padding:5px; background:#eee; margin:0 14px;}
或
.Pagination{ display:block; clear:both; text-align:center; padding:10px 0; background:#f8f8f8; margin:20px 0;}
改良后系统
CSS:
.pager{ margin-top:30px; background:#f8f8f8; text-align: center;}
.pager cur{ color:#f00; font-size: larger;}
.pager span{ margin:0 3px;}
.pager a{ margin:0 3px;}
.pager input{ width:auto; margin: 5px; padding:2px 15px;}
.pager input[name=jump]{ width:30px; padding:2px; text-align: center;}
JS:
var dir = "";
var qs = "";
$(function(){
if($(".pager").length>0){
$(".pager a").click(function () {
if ($(this).attr("page") < $("cur").attr("rel")) { dir = "prev"; }
$.send("",$.extend({ dir: dir,page: $(this).attr("page") },qs))
})
$("input[name=skip]").click(function () {
if ($("input[name=jump]").val() < $("cur").attr("rel")) { dir = "prev"; }
if ($("input[name=jump]").val() == $("cur").attr("rel")) { dir = $(this).attr("dir"); }
$.send("",$.extend({ dir: dir,page: $("input[name=jump]").val() },qs));
})
}
})
$.extend({
send: function (url,args) {
var body = $(document.body),
form = $("<form method='post'></form>"),
input;
form.attr({ "action": url });
$.each(args,function (key,value) {
input = $("<input type='hidden'>");
input.attr({ "name": key });
input.val(value);
form.append(input);
});
form.appendTo(document.body);
form.submit();
document.body.removeChild(form[0]);
}
});
|
|