极乐门资源网 Design By www.ioogu.com
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>可配置横栏滚动Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
* { margin:0; padding:0;}
body { font-size:12px;}
</style>
<script src="/UploadFiles/2021-04-02/jquery-1.4.1.js"><style type="text/css">
#scrollable {
background-color:#efefef;
border:1px solid #ddd;
padding:10px 8px;
width:523px;
height:65px;
margin-top:30px;
}
div.items {
height:66px;
margin-left:8px;
float:left;
width:475px !important;
}
div.items a {
display:block;
float:left;
margin-right:8px;
width:88px;
height:66px;
background:#BBB;
font-size:50px;
color:#ccc;
line-height:66px;
text-decoration:none;
text-align:center;
cursor:pointer;
}
div.items a:hover {
color:#999;
}
div.items a.active {
background-position:-174px 0;
color:#555;
cursor:default;
}
a.prev, a.next {
background:url(left.png) no-repeat 0 0;
display:block;
width:18px;
height:18px;
float:left;
margin:22px 0 0 0;
cursor:pointer;
}
a.next {
background-image:url(right.png)
}
a.prev:hover {
background-position:0 -18px;
}
a.next:hover {
background-position:0 -18px;
}
</style>
<script language="javascript" type="text/javascript">
(function ($) {
$.fn.extend({
Scroll: function (opt, callback) {
if (!opt) var opt = {};
var _btnleft = $(opt.left);
var _btnright = $(opt.right);
var timerID;
var _this = this.eq(0).find("div").eq(1);
var lineW = _this.find("a:first").width(), //获取列宽
line = opt.line ? parseInt(opt.line, 10) : parseInt(_this.width() / lineW, 10), //每次滚动的列数,默认为一屏,即父容器列宽
speed = opt.speed ? parseInt(opt.speed, 10) : 500; //滚动速度,数值越大,速度越慢(毫秒)
timer = opt.timer ? parseInt(opt.timer, 10) : 3000; //滚动的时间间隔(毫秒)
if (line == 0) line = 1;
var upWidth = 0 - line * lineW;
//滚动函数
var scrollLeft = function () {
if (!_this.is(":animated")) {
_this.animate({
left: upWidth
}, speed, function () {
for (i = 1; i <= line; i++) {
_this.find("a:first").appendTo(_this);
}
_this.css({ left: 0 });
});
}
}
var scrollRight = function () {
if (!_this.is(":animated")) {
for (i = 1; i <= line; i++) {
_this.find("a:last").show().prependTo(_this);
}
_this.css({ left: upWidth });
_this.animate({
left: 0
}, speed, function () {
});
}
} //Shawphy:自动播放
var autoPlay = function () {
if (timer) timerID = window.setInterval(scrollLeft, timer);
};
var autoStop = function () {
if (timer) window.clearInterval(timerID);
}; //鼠标事件绑定
_this.hover(autoStop, autoPlay).mouseout();
_btnleft.css("cursor", "pointer").click(scrollLeft).hover(autoStop, autoPlay);
_btnright.css("cursor", "pointer").click(scrollRight).hover(autoStop, autoPlay);
}
})
})(jQuery);
$(document).ready(function () {
$("#scrollable").Scroll({ line: 5, speed: 500, timer: 3000, left: ".prev", right: ".next"});
});
</script>
</head>
<body>
<div style="margin:0 auto;width:500px;">
<div id="scrollable">
<a class="prev" href="#"></a>
<div class="items" style="overflow: hidden; position: relative; visibility: visible; width: 478px;">
<div style="position: absolute; width: 200000em; left: 0px;" class="scrollable_demo">
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
<a>5</a>
<a>6</a>
<a>7</a>
<a>8</a>
<a>9</a>
<a>10</a>
<a>11</a>
<a>12</a>
<a>13</a>
<a>14</a>
<a>15</a>
</div>
<br clear="all"/>
</div>
<a class="next" href="#"></a>
</div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>可配置横栏滚动Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
* { margin:0; padding:0;}
body { font-size:12px;}
</style>
<script src="/UploadFiles/2021-04-02/jquery-1.4.1.js"><style type="text/css">
#scrollable {
background-color:#efefef;
border:1px solid #ddd;
padding:10px 8px;
width:523px;
height:65px;
margin-top:30px;
}
div.items {
height:66px;
margin-left:8px;
float:left;
width:475px !important;
}
div.items a {
display:block;
float:left;
margin-right:8px;
width:88px;
height:66px;
background:#BBB;
font-size:50px;
color:#ccc;
line-height:66px;
text-decoration:none;
text-align:center;
cursor:pointer;
}
div.items a:hover {
color:#999;
}
div.items a.active {
background-position:-174px 0;
color:#555;
cursor:default;
}
a.prev, a.next {
background:url(left.png) no-repeat 0 0;
display:block;
width:18px;
height:18px;
float:left;
margin:22px 0 0 0;
cursor:pointer;
}
a.next {
background-image:url(right.png)
}
a.prev:hover {
background-position:0 -18px;
}
a.next:hover {
background-position:0 -18px;
}
</style>
<script language="javascript" type="text/javascript">
(function ($) {
$.fn.extend({
Scroll: function (opt, callback) {
if (!opt) var opt = {};
var _btnleft = $(opt.left);
var _btnright = $(opt.right);
var timerID;
var _this = this.eq(0).find("div").eq(1);
var lineW = _this.find("a:first").width(), //获取列宽
line = opt.line ? parseInt(opt.line, 10) : parseInt(_this.width() / lineW, 10), //每次滚动的列数,默认为一屏,即父容器列宽
speed = opt.speed ? parseInt(opt.speed, 10) : 500; //滚动速度,数值越大,速度越慢(毫秒)
timer = opt.timer ? parseInt(opt.timer, 10) : 3000; //滚动的时间间隔(毫秒)
if (line == 0) line = 1;
var upWidth = 0 - line * lineW;
//滚动函数
var scrollLeft = function () {
if (!_this.is(":animated")) {
_this.animate({
left: upWidth
}, speed, function () {
for (i = 1; i <= line; i++) {
_this.find("a:first").appendTo(_this);
}
_this.css({ left: 0 });
});
}
}
var scrollRight = function () {
if (!_this.is(":animated")) {
for (i = 1; i <= line; i++) {
_this.find("a:last").show().prependTo(_this);
}
_this.css({ left: upWidth });
_this.animate({
left: 0
}, speed, function () {
});
}
} //Shawphy:自动播放
var autoPlay = function () {
if (timer) timerID = window.setInterval(scrollLeft, timer);
};
var autoStop = function () {
if (timer) window.clearInterval(timerID);
}; //鼠标事件绑定
_this.hover(autoStop, autoPlay).mouseout();
_btnleft.css("cursor", "pointer").click(scrollLeft).hover(autoStop, autoPlay);
_btnright.css("cursor", "pointer").click(scrollRight).hover(autoStop, autoPlay);
}
})
})(jQuery);
$(document).ready(function () {
$("#scrollable").Scroll({ line: 5, speed: 500, timer: 3000, left: ".prev", right: ".next"});
});
</script>
</head>
<body>
<div style="margin:0 auto;width:500px;">
<div id="scrollable">
<a class="prev" href="#"></a>
<div class="items" style="overflow: hidden; position: relative; visibility: visible; width: 478px;">
<div style="position: absolute; width: 200000em; left: 0px;" class="scrollable_demo">
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
<a>5</a>
<a>6</a>
<a>7</a>
<a>8</a>
<a>9</a>
<a>10</a>
<a>11</a>
<a>12</a>
<a>13</a>
<a>14</a>
<a>15</a>
</div>
<br clear="all"/>
</div>
<a class="next" href="#"></a>
</div>
</div>
</body>
</html>
说明:1、需要两个图片
left.png:
right.png:
2、需要引入jquery的包,这个应该不用说的......
标签:
循环,左右滚动
极乐门资源网 Design By www.ioogu.com
极乐门资源网
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
极乐门资源网 Design By www.ioogu.com
暂无基于jquery可配置循环左右滚动例子的评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2025年01月16日
2025年01月16日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]