html上一页下一页 jq,jquery 实现分页 前端分页

fcb6ea137a8a

image.png

html

math?formula=(function()%7B%20var%20page%20%3D%201%3B%20var%20i%20%3D%204%3B%20%2F%2F%E6%AF%8F%E7%89%88%E6%94%BE4%E4%B8%AA%E5%9B%BE%E7%89%87%20%2F%2F%E5%90%91%E5%90%8E%20%E6%8C%89%E9%92%AE("span.next").click(function(){ //绑定click事件

var

math?formula=parent%20%3D(this).parents("div.v_show");//根据当前点击元素获取到父元素

var

math?formula=v_show%20%3Dparent.find("div.v_content_list"); //寻找到“视频内容展示区域”

var

math?formula=v_content%20%3Dparent.find("div.v_content"); //寻找到“视频内容展示区域”外围的DIV元素

var v_width =

math?formula=v_content.width()%20%3B%20var%20len%20%3Dv_show.find("li").length;

var page_count = Math.ceil(len / i) ; //只要不是整数,就往大的方向取最小的整数

if( !

math?formula=v_show.is(%22%3Aanimated%22)%20)%7B%20%2F%2F%E5%88%A4%E6%96%AD%E2%80%9C%E8%A7%86%E9%A2%91%E5%86%85%E5%AE%B9%E5%B1%95%E7%A4%BA%E5%8C%BA%E5%9F%9F%E2%80%9D%E6%98%AF%E5%90%A6%E6%AD%A3%E5%9C%A8%E5%A4%84%E4%BA%8E%E5%8A%A8%E7%94%BB%20if(%20page%20%3D%3D%20page_count%20)%7B%20%2F%2F%E5%B7%B2%E7%BB%8F%E5%88%B0%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E7%89%88%E9%9D%A2%E4%BA%86%2C%E5%A6%82%E6%9E%9C%E5%86%8D%E5%90%91%E5%90%8E%EF%BC%8C%E5%BF%85%E9%A1%BB%E8%B7%B3%E8%BD%AC%E5%88%B0%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%89%88%E9%9D%A2%E3%80%82v_show.animate({ left : '0px'}, "slow"); //通过改变left值,跳转到第一个版面

page = 1;

}else{

math?formula=v_show.animate(%7B%20left%20%3A%20'-%3D'%2Bv_width%20%7D%2C%20%22slow%22)%3B%20%2F%2F%E9%80%9A%E8%BF%87%E6%94%B9%E5%8F%98left%E5%80%BC%EF%BC%8C%E8%BE%BE%E5%88%B0%E6%AF%8F%E6%AC%A1%E6%8D%A2%E4%B8%80%E4%B8%AA%E7%89%88%E9%9D%A2%20page%2B%2B%3B%20%7Dparent.find("span").eq((page-1)).addClass("current").siblings().removeClass("current");

}

});

//往前 按钮

math?formula=(%22span.prev%22).click(function()%7B%20varparent =

math?formula=(this).parents(%22div.v_show%22)%3B%2F%2F%E6%A0%B9%E6%8D%AE%E5%BD%93%E5%89%8D%E7%82%B9%E5%87%BB%E5%85%83%E7%B4%A0%E8%8E%B7%E5%8F%96%E5%88%B0%E7%88%B6%E5%85%83%E7%B4%A0%20varv_show =

math?formula=parent.find(%22div.v_content_list%22)%3B%20%2F%2F%E5%AF%BB%E6%89%BE%E5%88%B0%E2%80%9C%E8%A7%86%E9%A2%91%E5%86%85%E5%AE%B9%E5%B1%95%E7%A4%BA%E5%8C%BA%E5%9F%9F%E2%80%9D%20varv_content =

math?formula=parent.find(%22div.v_content%22)%3B%20%2F%2F%E5%AF%BB%E6%89%BE%E5%88%B0%E2%80%9C%E8%A7%86%E9%A2%91%E5%86%85%E5%AE%B9%E5%B1%95%E7%A4%BA%E5%8C%BA%E5%9F%9F%E2%80%9D%E5%A4%96%E5%9B%B4%E7%9A%84DIV%E5%85%83%E7%B4%A0%20var%20v_width%20%3Dv_content.width();

var len =

math?formula=v_show.find(%22li%22).length%3B%20var%20page_count%20%3D%20Math.ceil(len%20%2F%20i)%20%3B%20%2F%2F%E5%8F%AA%E8%A6%81%E4%B8%8D%E6%98%AF%E6%95%B4%E6%95%B0%EF%BC%8C%E5%B0%B1%E5%BE%80%E5%A4%A7%E7%9A%84%E6%96%B9%E5%90%91%E5%8F%96%E6%9C%80%E5%B0%8F%E7%9A%84%E6%95%B4%E6%95%B0%20if(%20!v_show.is(":animated") ){ //判断“视频内容展示区域”是否正在处于动画

if( page == 1 ){ //已经到第一个版面了,如果再向前,必须跳转到最后一个版面。

math?formula=v_show.animate(%7B%20left%20%3A%20'-%3D'%2Bv_width*(page_count-1)%20%7D%2C%20%22slow%22)%3B%20page%20%3D%20page_count%3B%20%7Delse%7Bv_show.animate({ left : '+='+v_width }, "slow");

page--;

}

$parent.find("span").eq((page-1)).addClass("current").siblings().removeClass("current");

}

});

});

卡通动漫

1234

上一页

下一页

更多>>

style.css

{ margin:0; padding:0; word-break:break-all; }

body { background:#FFF; color:#333; font:12px/1.5em Helvetica, Arial, sans-serif; }

h1, h2, h3, h4, h5, h6 { font-size:1em; }

a { color:#2B93D2; text-decoration:none; }

a:hover { color:#E31E1C; text-decoration:underline; }

ul, li { list-style:none; }

fieldset, img { border:none; }

/* v_show style */

.v_show { width:595px; margin:20px 0 1px 60px; }

.v_caption { height:35px; overflow:hidden; background:url(img/btn_cartoon.gif) no-repeat 0 0; }

.v_caption h2 { float:left; width:84px; height:35px; overflow:hidden; background:url(img/btn_cartoon.gif) no-repeat; text-indent:-9999px; }

.v_caption .cartoon { background-position: 0 -100px; }

.v_caption .variety { background-position:-100px -100px; }

.highlight_tip { display:inline; float:left; margin:14px 0 0 10px; }

.highlight_tip span { display:inline; float:left; width:7px; height:7px; overflow:hidden; margin:0 2px; background:url(img/btn_cartoon.gif) no-repeat 0 -320px; text-indent:-9999px; }

.highlight_tip .current { background-position:0 -220px; }

.change_btn { float:left; margin:7px 0 0 10px; }

.change_btn span { display:block; float:left; width:30px; height:23px; overflow:hidden; background:url(img/btn_cartoon.gif) no-repeat; text-indent:-9999px; cursor:pointer; }

.change_btn .prev { background-position:0 -400px; }

.change_btn .next { width:31px; background-position:-30px -400px; }

.v_caption em { display:inline; float:right; margin:10px 12px 0 0; font-family:simsun; }

.v_content { position:relative; width:592px; height:160px; overflow:hidden; border-right:1px solid #E7E7E7; border-bottom:1px solid #E7E7E7; border-left:1px solid #E7E7E7; }

.v_content_list { position:absolute; width:2500px;top:0px; left:0px; }

.v_content ul {float:left;}

.v_content ul li { display:inline; float:left; margin:10px 2px 0; padding:8px; background:url(img/v_bg.gif) no-repeat; }

.v_content ul li a { display:block; width:128px; height:80px; overflow:hidden; }

.v_content ul li img { width:128px; height:96px; }

.v_content ul li h4 { width:128px; height:18px; overflow:hidden; margin-top:12px; font-weight:normal; }

.v_content ul li h4 a { display:inline !important; height:auto !important; }

.v_content ul li span { color:#666; }

.v_content ul li em { color:#888; font-family:Verdana; font-size:0.9em; }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值