html圖片循環
1. 在html中怎麼處理讓3張圖片無限循環!
只用html是實現不了的
html里的marque雖然可以無限循環滾動 但之間有間隙
如果要實現無間隙的連續循環 就只能用js
直接網路搜索 js 連續循環 有很多的!
希望能幫助到你!祝你生活愉快!
2. 【HTML】如何實現無縫循環的圖片滾動效果
網站中,有時為了更好的利用有限的頁面空間展示更多的內容,也為了豐富網站頁面自身的表現樣式,我們往往會用到圖片滾動的效果。想要實現這種效果,只需要在想要顯示的表格或網頁中加入以下代碼即可實現: <div id=demo style="overflow:hidden;height:100px;width:300px;"><table align=left cellpadding=0 cellspace=0 border=0><tr><td id=demo1 valign=top> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0056_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0053_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0054_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0058_縮小大小.JPG" /> <img height="200" alt="" width="150" src="/lazysite/user_space/7788/CIMG0059_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0063_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0070_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0071_縮小大小.JPG" /> <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0072_縮小大小.JPG" /> //這個圖片的地址可以是相對的也可以是絕對的 </td><td id=demo2 valign=top></td></tr></table></div><script>var speed=30 demo2.innerHTML=demo1.innerHTML function Marquee(){ if(demo2.offsetWidth-demo.scrollLeft<=0) demo.scrollLeft-=demo1.offsetWidthelse{demo.scrollLeft++}}var MyMar=setInterval(Marquee,speed) demo.onmouseover=function() {clearInterval(MyMar)} demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}</script>下面,我們就上面代碼的主要部分進行分析: <div id=demo style="overflow:hidden;height:100px;width:300px;"> 這段代碼中下劃線的部分表示我們這段滾動圖片所佔用區域的大小。用戶可根據頁面的實際需要進行調節。但一般情況下至少要大於或等於圖片的高度和寬度。 <img height="150" alt="" width="200" src="/lazysite/user_space/7788/CIMG0056_縮小大小.JPG" /> 上面這段代碼是圖片的代碼。每加入一行如上代碼,那就會多出一個展示的圖片。圖片可以是一個,也可以是無數個。需要強調的是,每個圖片的高度和寬度應盡量的統一大小,主要顯示出來的效果才會更好看。 var speed=30 這行代碼是控制圖片滾動的速度。數字越小,滾動的也就越快;相反,數字越大,滾動的也就越慢。
3. html圖片循環的問題
function changeSrc(nIndex){
var imageList = new Array();
imageList.push("1.jpg");
imageList.push("2.jpg");
var obj = document.getElementById("imagecontain");
obj.src = imageList[nIndex%imageList.length];
}
<div><img id="imagecontain" src="1.jpg" /></div>
<script>
var nIndex = 1;
objTimer = window.setInterval(function(){
changeSrc(nIndex);
nIndex++;
},1000);
document.getElementById("imagecontain").onmousemove = function(){
clearInterval(objTimer)
}
document.getElementById("imagecontain").onmouseout = function(){
objTimer = window.setInterval(function(){
changeSrc(nIndex);
nIndex++;
},1000);
}
</script>
</body>
4. HTML中圖片循環代碼,急!
可以去相關網站剝離代碼
自己寫復雜的容易出錯
點文件,查看源代碼,找到SCRIPT,剝離出來即可
5. 在HTML中圖片連續循環的語句怎麼寫
滾動播放么?!需要js
<div id="butong_net_left" style="overflow:hidden; width:500px;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="butong_net_left1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><img src="<img src="_LAYOUTS/Image/hexi/body-11.jpg"></td>
<td><img src="_LAYOUTS/Image/hexi/body-11.jpg"></td>
<td><img src="_LAYOUTS/Image/hexi/body-11.jpg"></td>
</tr>
</table>
</td>
<td id="butong_net_left2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=30//速度數值越大速度越慢
butong_net_left2.innerHTML=butong_net_left1.innerHTML
function Marquee3(){
if(butong_net_left2.offsetWidth-butong_net_left.scrollLeft<=0)
butong_net_left.scrollLeft-=butong_net_left1.offsetWidth
else{
butong_net_left.scrollLeft++
}
}
var MyMar3=setInterval(Marquee3,speed)
butong_net_left.onmouseover=function() {clearInterval(MyMar3)}
butong_net_left.onmouseout=function() {MyMar3=setInterval(Marquee3,speed)}
</script>
6. html代碼循環顯示圖片
<script language="javascript">
//將七個圖片的文件名以「|」為分隔組成一個字元變數,images為圖片文件所在文件夾,與網頁文件在同一目錄下
var pic="images/1.jpg|images/2.jpg|images/3.jpg|images/4.jpg|images/5.jpg|images/6.jpg|images/7.jpg";
p=pic.split("|");
var td=new Date();
i=td.getDay();
document.write("<img src='"+p[i]+"' width=60 height=80>");
//width,height為圖片的寬與高
</SCRIPT>
將以上代碼插入到網頁中你所需要的位置,即可實現你所要求的。
7. html圖片循環代碼
<!DOCTYPEhtmlPUBLIC"-//W3C//DtdXHTML1.0Transitional//EN""http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<title>www.boaer.com</title>
<styletype="text/css">
img{
border:0;
height:100px;width:150px;
}
tdimg{
margin:010px;
}
</style>
</head>
<body>
<!--圖片縱向無縫循環滾動-->
<divid="demo"style="overflow:hidden;height:350px;width:200px">
<divid="demo1">
<ahref="http://www.boaer.com"target="_blank"><imgsrc="/images/m01.jpg"></a><p>
<ahref="http://www.boaer.com"target="_blank"><imgsrc="/images/m02.jpg"></a><p>
<ahref="http://www.boaer.com"target="_blank"><imgsrc="/images/m03.jpg"></a><p>
<ahref="http://www.boaer.com"target="_blank"><imgsrc="/images/m04.jpg"></a><p>
<ahref="http://www.boaer.com"target="_blank"><imgsrc="/images/m05.jpg"></a><p>
<ahref="http://www.boaer.com"target="_blank"><imgsrc="/images/m06.jpg"></a><p>
</div>
<divid="demo2">
</div>
</div>
<script>
varspeed=40;
vardemo2=document.getElementById("demo2");
vardemo1=document.getElementById("demo1");
vardemo=document.getElementById("demo");
demo2.innerHTML=demo1.innerHTML
functionMarquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight;
else{
demo.scrollTop++;
}
}
varMyMar=setInterval(Marquee,speed);
demo.onmouseover=function(){clearInterval(MyMar)}
demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)}
</script>
</body>
</html>
<br><br><hr><palign="center"><fontcolor=black>本特效<ahref="http://boaer.com"target="_blank">博艾爾</a>丨boaer.com收集於互聯網,只為興趣與學習交流,不作商業用途。</font></p>
8. html圖片向左無縫隙循環滾動代碼
用css3實現循環滾動效果:
css:
#wrap{
width:200px;
height:150px;
border:1pxsolid#000;
position:relative;
margin:100pxauto;
overflow:hidden;
}
#list{
position:absolute;
left:0;
top:0;
margin:0;
padding:0;
animation:move12sinfinitelinear;
-webkit-animation:move12sinfinitelinear;
width:500%;
}
#listli{
list-style:none;
width:200px;
height:150px;
border:0;
float:left;
}
@-webkit-keyframesmove{
0%{
left:0;
}
100%{
left:-800px;
}
}
@keyframesmove{
0%{
left:0;
}
100%{
left:-800px;
}
}
#wrap:hover#list{
-webkit-animation-play-state:paused;/*動畫暫停播放*/
}
html:
<divid="wrap">
<ulid="list">
<li><ahref="#"><imgsrc="img/1.jpg"border="0"/></a></li>
<li><ahref="#"><imgsrc="img/2.jpg"border="0"/></a></li>
<li><ahref="#"><imgsrc="img/3.jpg"border="0"/></a></li>
<li><ahref="#"><imgsrc="img/4.jpg"border="0"/></a></li>
<li><ahref="#"><imgsrc="img/5.jpg"border="0"/></a></li>
</ul>
</div>
(8)html圖片循環擴展閱讀:
animation(動畫)屬性:
語法:
animation: name ration timing-function delay iteration-count direction fill-mode play-state;
參數:
1、animation-name:指定要綁定到選擇器的關鍵幀的名稱。
2、animation-ration:動畫指定需要多少秒或毫秒完成。
3、animation-timing-function:設置動畫將如何完成一個周期。
值:
linear:動畫從頭到尾的速度是相同的。
ease:默認。動畫以低速開始,然後加快,在結束前變慢。
ease-in:動畫以低速開始。
ease-out:動畫以低速結束。
ease-in-out:動畫以低速開始和結束。
cubic-bezier(n,n,n,n):在 cubic-bezier 函數中自己的值。可能的值是從 0 到 1 的數值。
4、animation-delay:設置動畫在啟動前的延遲間隔。
5、animation-iteration-count :定義動畫的播放次數。
值:
n:一個數字,定義應該播放多少次動畫。
infinite:指定動畫應該播放無限次(永遠) 。
9. 如何在HTML頁面中實現圖片循環滾動
<DIV id=demo style="OVERFLOW: hidden; WIDTH: 600px; HEIGHT: 190px; top:485px; left:252px;position: absolute;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" id=demo1>
<!-- 要循環滾動的圖片 -->
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td width="200" align="center" style="height: 151px">
<a href="WebDeSign.aspx">
<img src="images/indexpic1.gif" width="194" height="147" border="0" /></a>
</td>
<td width="200" align="center" style="height: 151px">
<a href="SoftWare.aspx">
<img src="images/indexpic2.gif" width="194" height="147" border="0" /></a>
</td>
<td align="center" style="height: 151px; width: 200px;">
<a href="VhostIndex.aspx">
<img src="images/indexpic3.gif" width="194" height="147" border="0" /></a>
</td>
</tr>
</table>
</td>
<TD id=demo2 width=1></TD>
</tr>
</table>
</DIV>
<SCRIPT>
var speed=30//速度數值越大速度越慢
var demo2 = document.getElementById("demo2");
var demo = document.getElementById("demo");
var demo1 = document.getElementById("demo1");
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</SCRIPT>
自己站的效果
你可以訪問 http://b1.gd.cn
希望對你有幫助。。(*^__^*)