當前位置:首頁 » 健康資訊 » 圖片可以無間斷滾動嗎
擴展閱讀
怎樣在表格里寫10的8次方 2025-06-03 08:02:28
哪個網站的畫可以下載 2025-06-03 07:43:42
文件可以呈報多個部門嗎 2025-06-03 07:42:58

圖片可以無間斷滾動嗎

發布時間: 2022-02-22 01:53:23

① 如何讓網頁中的圖片不間斷的滾動

使用MSClass.js組件吧
瞬間解決你水平滾動、垂直滾動,還可以定時滾動,自定義功能強。
www.hanzhen2000.com
你看看他們這個站上的滾動,就是我用MSClass.js解決的。
你可以參考一下。
麻煩採納,謝謝!

② 在html中滾動圖片如何不間斷滾動

原生js實現輪播圖
很多網站上都有輪播圖,但卻很難找到一個系統講解的,因此這里做一個簡單的介紹,希望大家都能有所收獲,如果有哪些不正確的地方,希望大家可以指出。

github地址 (如果有用,就star一下吧)原理:
將一些圖片在一行中平鋪,然後計算偏移量再利用定時器實現定時輪播。

③ 圖片無間斷滾動問題

代碼問題不好改
或者換這個無縫上下左右滾動加定高定寬停頓效果 試試吧

④ <marquee>能不能實現圖片無間斷滾動

在html中使得圖片滾動方法很多,其中marquee使用的最多,marquee圖片連續不間斷滾動,可以向上、向下、向左、向右。通過以下四段不同方向滾動的代碼,可以使得圖片向不各個方向進行滾動。這里給出向左滾動的具體的事例

在看具體代碼之前,了解一下對象的幾個的屬性:
innerHTML: 設置或獲取位於對象起始和結束標簽內的 HTML
scrollHeight: 獲取對象的滾動高度。
scrollLeft: 設置或獲取位於對象左邊界和窗口中目前可見內容的最左端之間的距離
scrollTop: 設置或獲取位於對象最頂端和窗口中可見內容的最頂端之間的距離
scrollWidth: 獲取對象的滾動寬度
offsetHeight: 獲取對象相對於版面或由父坐標 offsetParent 屬性指定的父坐標的高度
offsetLeft: 獲取對象相對於版面或由 offsetParent 屬性指定的父坐標的計算左側位置
offsetTop: 獲取對象相對於版面或由 offsetTop 屬性指定的父坐標的計算頂端位置
offsetWidth: 獲取對象相對於版面或由父坐標 offsetParent 屬性指定的父坐標的寬度

圖片向上無縫滾動
以下是具體代碼:
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 100px;
text-align: center;
float: left;
}
#demo img {
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>

<div id="demo">
<div id="demo1">
<a href="#"><img src="/66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>

<script>
<!--
var speed=10; //數字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1為demo2
function Marquee(){
if(tab2.offsetTop-tab.scrollTop<=0)//當滾動至demo1與demo2交界時
tab.scrollTop-=tab1.offsetHeight //demo跳到最頂端
else{
tab.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};//滑鼠移上時清除定時器達到滾動停止的目的
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//滑鼠移開時重設定時器
-->
</script>

圖片向下無縫滾動
以下是具體代碼:
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 100px;
text-align: center;
float: left;
}
#demo img {
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>
向下滾動
<div id="demo">
<div id="demo1">
<a href="#"><img src="/66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>

<script>
<!--
var speed=10; //數字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1為demo2
tab.scrollTop=tab.scrollHeight
function Marquee(){
if(tab1.offsetTop-tab.scrollTop>=0)//當滾動至demo1與demo2交界時
tab.scrollTop+=tab2.offsetHeight //demo跳到最頂端
else{
tab.scrollTop--
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};//滑鼠移上時清除定時器達到滾動停止的目的
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//滑鼠移開時重設定時器
-->
</script>

圖片向左無縫滾動
以下是具體代碼:
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
向左滾動
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="#"><img src="/66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div>

<script>
<!--
var speed=10; //數字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>

圖片向右無縫滾動
以下是具體代碼:
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
向右滾動
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="#"><img src="/66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
<a href="#"><img src="66php.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div>

<script>
<!--
var speed=10; //數字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab.scrollLeft<=0)
tab.scrollLeft+=tab2.offsetWidth
else{
tab.scrollLeft--;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>

⑤ html網頁設計中,如何設置無間斷循滾動環圖片

這是我曾經寫的一個簡易二次方緩動輪播器/**
* Player 輪播器
* @param object obj
* @author [email protected]
* obj{
* frame //內容框架,position:absolute;
* lists //輪播內容節點數組,注意這個父容器的lists復寫一次,如果是ul,則ul.innerHTML+=ul.innerHTML,呈現不間斷滾動
* time //跳幀時間3000ms
*
* }
*/
function Player(obj){
this.frame=obj.frame, //內容框架
this.lists=obj.lists, //移動節點
this.time=obj.time||3000, //幀翻滾間隔
this.index=0, //初始化第一幀位置
this.step=this.lists[0].offsetHeight||0 ; //翻滾步長
this.run();
}
Player.prototype={
//跳幀
skip:function(time){
this.skipInterval&&clearInterval(this.skipInterval);
var _this=this;
var des=this.lists[this.index].relatedPosition;
var t=0;
this.skipInterval=setInterval(function(){
t+=10;
_this.frame.style.top=_this.lists[_this.index-1].relatedPosition-Math.ceil(_this.step*Math.pow(t/time,2))+"px";
if(t==time){
clearInterval(_this.skipInterval);
}
},10);

},
//下一幀
next:function(){
this.index+=1;
if(this.index>this.lists.length/2) {
this.frame.style.top="0px";
this.index=1;
}
this.skip(300);
},
//開始跳幀
start:function(){
var _this=this;
this.interval=setInterval(function(){
_this.next();
},this.time);
},
//停止跳幀
stop:function(){
clearInterval(this.interval);
},
//初始化輪播器
run:function(){
this.start();
this.deal();
},
//幀處理
deal:function(){
var _this=this;
for(var i=0;i<this.lists.length;i++){
this.lists[i].relatedPosition=-this.lists[i].offsetTop;
this.lists[i].onmouseover=function(){
_this.stop();
}
this.lists[i].onmouseout=function(){
_this.start();
}
}
}
}

⑥ 圖片不間斷左右滾動效果,並且可以控制方向

<div id="demo" style="overflow:hidden;width:510px; border:1px solid blue;">

<div id="demo1">

<table cellspacing="0">

<tr>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>
<td><img src="http://www..com/img/lm.gif"></td>
<td><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-.gif"></td>

</tr>

</table>

</div>

<div id="demo2"></div>

</div>
<input type="button" value="向左" onclick="changeRedirect(0)">
<input type="button" value="向右" onclick="changeRedirect(1)">

<script style="text/javascript">

var speed=40;//數值越大,速度越慢

var demo2=document.getElementById("demo2");

var demo1=document.getElementById("demo1");

var demo=document.getElementById("demo");

demo.scrollLeft=demo.scrollWidth

function MarqueeLeft(){

if(demo2.offsetWidth-demo.scrollLeft<=0)

demo.scrollLeft-=demo1.offsetWidth

else{

demo.scrollLeft++

}

}

function MarqueeRight(){

if(demo.scrollLeft<=0)

demo.scrollLeft+=demo2.offsetWidth

else{

demo.scrollLeft--

}

}

var MyMar=setInterval(MarqueeRight,speed);

demo.onmouseover=function() {clearInterval(MyMar);}

demo.onmouseout=function() {MyMar=setInterval(MarqueeRight,speed);}

function changeRedirect(i)
{
clearInterval(MyMar);
if(i==0)
{
MyMar=setInterval(MarqueeLeft,speed);
demo.onmouseout=function() {MyMar=setInterval(MarqueeLeft,speed);}
}
else
{
MyMar=setInterval(MarqueeRight,speed);
demo.onmouseout=function() {MyMar=setInterval(MarqueeRight,speed);}
}

}

</script>

⑦ 如何在HTML實現圖片無間隙循環滾動

<SCRIPT language=JavaScript>
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images2005/03/1.gif' 圖片路徑
Pic[1] = 'images2005/03/2.gif'
Pic[2] = 'images2005/03/3.gif'
Pic[3] = 'images2005/03/4.gif'
Pic[4] = 'images2005/03/5.gif'
Pic[5] = 'images2005/03/6.gif'
Pic[6] = 'images2005/03/7.gif'
Pic[7] = 'images2005/03/8.gif'
Pic[8] = 'images2005/03/9.gif'
Pic[9] = 'images2005/03/10.gif'
// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(ration=2)";
document.images.SlideShow.style.filter="blendTrans(ration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
</SCRIPT>

將BODY改為 <BODY onload=runSlideShow()>

⑧ 網站圖片連續不間斷滾動

參數自己可以修改一下

<div class="zhanshi" id="demo" style="overflow:hidden;height:auto;width:663px;color:#ff0000;">
<table align=left cellpadding=0 cellspace=0 border=0>
<tr>
<td id="demo1" valign="top">
<table>
<tr>
<td><img src="dsfdf" width="200"/></td>
<td><img src="dsfdf" width="200"/></td>
<td><img src="dsfdf" width="200"/></td>
<td><img src="dsfdf" width="200"/></td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var demo=document.getElementById("demo")
var demo1=document.getElementById("demo1")
var demo2=document.getElementById("demo2")
var speed=1//速度數值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
window.onload=function(){
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}
</script>