复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312" />
<title>图片减速度滚动(by rentj1@163.com;)</title>
<style>
ul{ margin:0; padding:0}
ul{ list-style:none;}
body{font:12px/1.2 "宋体"; }
.scroll_box{ position:relative; height:164px; width:766px; border:1px solid #efefef; overflow:hidden;}
.scroll_box .list{ overflow:hidden; zoom:1; position:absolute;}
.scroll_box .list li{ width:235px; height:164px; padding:0 10px; text-align:center; float:left;}
.scroll_box .list .info{ line-height:1.5}
</style>
</head>
<body>
<div class="scroll_box" id="container">
<ul class="list" id="content">
<li>
<img src="/UploadFiles/2021-04-02/cd8a8a76-24f4-44d8-876b-12d78cbae588.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/9230eaef-021c-447d-a64b-51ce698822ef.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/7691b514-a0b3-469e-8a2b-37b219ebc490.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/c675cbb0-3a6f-4703-95fb-e75a7c90b48e.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/22aa7c6d-4b70-49b8-a985-678b1d0e3781.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/cf09b35a-eb6d-4a4f-a4dd-3301bfafef99.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
</ul>
</div>
<script>
untils = {
getComputedStyle: function(elem,syle){
var computedStyle = document.defaultView
&& document.defaultView.getComputedStyle
&& document.defaultView.getComputedStyle(elem,null);
if(!computedStyle){
computedStyle = elem.currentStyle
}
return computedStyle[syle]
},
setStyle: function(elem, name,val){
elem.style[name] = val;
},
get: function(id){
document.getElementById(id)
}
}
function ScrollSlider(container, content){
var clone = content.cloneNode(true);
var initcss= "left:0; top:0";
var contentHeight = content.offsetHeight;
var containerHeight = container.clientHeight;
clone.id = "content-clone";
container.appendChild(clone);
clone.setAttribute("cssText", initcss);
content.setAttribute("cssText", initcss);
clone.style.marginTop = contentHeight+"px";
this.content = content;
this.clone = clone;
this.container = container;
this.containerHeight = containerHeight;
this.contentHeight = contentHeight;
}
ScrollSlider.prototype = {
start: function(delay){
var _this = this;
clearInterval(_this.timer);
_this.timer = setInterval(function(){
_this.scroll();
},delay);
},
scroll: function(){
var marginTop = parseInt(untils.getComputedStyle(this.content, "marginTop"));
var offsetTop = this.contentHeight;
if(isNaN(marginTop))return;
if( -marginTop >= this.contentHeight){
marginTop = this.contentHeight;
}
if(marginTop > 0){
offsetTop = -offsetTop;
}
this.move(marginTop, offsetTop);
},
move: function(marginTop, offsetTop){
var s = this.containerHeight, s1 = 0, _this = this, m = 0;
var timer = setInterval(function(){
var speed = (s-s1)/8;
speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
s1 += speed;
m = marginTop - s1;
untils.setStyle(_this.content, "marginTop", m + "px");
untils.setStyle(_this.clone, "marginTop", (m + offsetTop)+"px");
if(s-s1 <= 0){
clearInterval(timer);
}
},30);
}
};
var container = document.getElementById("container")
var content = document.getElementById("content")
var xx = new ScrollSlider(container, content);
xx.start(1000*3);
/*
//s=1/2 * at^2
//s (att)/2
//0<s<164
0,-164,-328,164,0
328,164,0,-164,-328,164,0
*/
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312" />
<title>图片减速度滚动(by rentj1@163.com;)</title>
<style>
ul{ margin:0; padding:0}
ul{ list-style:none;}
body{font:12px/1.2 "宋体"; }
.scroll_box{ position:relative; height:164px; width:766px; border:1px solid #efefef; overflow:hidden;}
.scroll_box .list{ overflow:hidden; zoom:1; position:absolute;}
.scroll_box .list li{ width:235px; height:164px; padding:0 10px; text-align:center; float:left;}
.scroll_box .list .info{ line-height:1.5}
</style>
</head>
<body>
<div class="scroll_box" id="container">
<ul class="list" id="content">
<li>
<img src="/UploadFiles/2021-04-02/cd8a8a76-24f4-44d8-876b-12d78cbae588.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/9230eaef-021c-447d-a64b-51ce698822ef.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/7691b514-a0b3-469e-8a2b-37b219ebc490.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/c675cbb0-3a6f-4703-95fb-e75a7c90b48e.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/22aa7c6d-4b70-49b8-a985-678b1d0e3781.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
<li>
<img src="/UploadFiles/2021-04-02/cf09b35a-eb6d-4a4f-a4dd-3301bfafef99.jpg"><div class="info">
兵尼兔 环保大包围专车专用脚垫 米色(专车专用,仅支持在线支付)版型精准 大包围
</div>
<span class="price">会员价:¥288.00</span>
</li>
</ul>
</div>
<script>
untils = {
getComputedStyle: function(elem,syle){
var computedStyle = document.defaultView
&& document.defaultView.getComputedStyle
&& document.defaultView.getComputedStyle(elem,null);
if(!computedStyle){
computedStyle = elem.currentStyle
}
return computedStyle[syle]
},
setStyle: function(elem, name,val){
elem.style[name] = val;
},
get: function(id){
document.getElementById(id)
}
}
function ScrollSlider(container, content){
var clone = content.cloneNode(true);
var initcss= "left:0; top:0";
var contentHeight = content.offsetHeight;
var containerHeight = container.clientHeight;
clone.id = "content-clone";
container.appendChild(clone);
clone.setAttribute("cssText", initcss);
content.setAttribute("cssText", initcss);
clone.style.marginTop = contentHeight+"px";
this.content = content;
this.clone = clone;
this.container = container;
this.containerHeight = containerHeight;
this.contentHeight = contentHeight;
}
ScrollSlider.prototype = {
start: function(delay){
var _this = this;
clearInterval(_this.timer);
_this.timer = setInterval(function(){
_this.scroll();
},delay);
},
scroll: function(){
var marginTop = parseInt(untils.getComputedStyle(this.content, "marginTop"));
var offsetTop = this.contentHeight;
if(isNaN(marginTop))return;
if( -marginTop >= this.contentHeight){
marginTop = this.contentHeight;
}
if(marginTop > 0){
offsetTop = -offsetTop;
}
this.move(marginTop, offsetTop);
},
move: function(marginTop, offsetTop){
var s = this.containerHeight, s1 = 0, _this = this, m = 0;
var timer = setInterval(function(){
var speed = (s-s1)/8;
speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
s1 += speed;
m = marginTop - s1;
untils.setStyle(_this.content, "marginTop", m + "px");
untils.setStyle(_this.clone, "marginTop", (m + offsetTop)+"px");
if(s-s1 <= 0){
clearInterval(timer);
}
},30);
}
};
var container = document.getElementById("container")
var content = document.getElementById("content")
var xx = new ScrollSlider(container, content);
xx.start(1000*3);
/*
//s=1/2 * at^2
//s (att)/2
//0<s<164
0,-164,-328,164,0
328,164,0,-164,-328,164,0
*/
</script>
</body>
</html>
标签:
图片,减速度,滚动
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“常见JS效果之图片减速度滚动实现代码”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
2024年11月09日
2024年11月09日
- 雨林唱片《赏》新曲+精选集SACD版[ISO][2.3G]
- 罗大佑与OK男女合唱团.1995-再会吧!素兰【音乐工厂】【WAV+CUE】
- 草蜢.1993-宝贝对不起(国)【宝丽金】【WAV+CUE】
- 杨培安.2009-抒·情(EP)【擎天娱乐】【WAV+CUE】
- 周慧敏《EndlessDream》[WAV+CUE]
- 彭芳《纯色角3》2007[WAV+CUE]
- 江志丰2008-今生为你[豪记][WAV+CUE]
- 罗大佑1994《恋曲2000》音乐工厂[WAV+CUE][1G]
- 群星《一首歌一个故事》赵英俊某些作品重唱企划[FLAC分轨][1G]
- 群星《网易云英文歌曲播放量TOP100》[MP3][1G]
- 方大同.2024-梦想家TheDreamer【赋音乐】【FLAC分轨】
- 李慧珍.2007-爱死了【华谊兄弟】【WAV+CUE】
- 王大文.2019-国际太空站【环球】【FLAC分轨】
- 群星《2022超好听的十倍音质网络歌曲(163)》U盘音乐[WAV分轨][1.1G]
- 童丽《啼笑姻缘》头版限量编号24K金碟[低速原抓WAV+CUE][1.1G]