导航:首页 > 万维百科 > 网页设计如何设置图片循环滚动

网页设计如何设置图片循环滚动

发布时间:2020-10-13 07:37:05

1、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();
}
}
}
}

2、网页制作中 无限循环滚动的图片代码

我自己用jquery写的纵向的,想要横向的我可以帮你改改。
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-

8" />
<title>无标题文档</title>
<script language="javascript" src="jquery.js"></script>
<script language="javascript">
$(document).ready(function() {
var height = $("ul li").height();
var ul = $("ul");
var picTimer;
var btn = "<div class='scroll_btn pre'></div><div

class='scroll_btn next'></div>";
//$("ul").append(btn);
$("ul").hover(function() {
clearInterval(picTimer);
},function() {
picTimer = setInterval(
function() {
var field = $("ul

li:first");
field.animate

({marginTop:-height+'px'},600,function(){
field.appendTo

(ul).css('marginTop',0);
})
},3000
);
}).trigger("mouseleave");
//下一个需要 研究
$(".pre").click(function() {
var field = $("ul li:first");
var lastField = $("ul li:last");
field.animate({marginTop:height

+'px'},600,function(){
lastField.insertBefore(field);
});
});

$(".next").click(function() {
var field = $("ul li:first");
field.animate

({marginTop:-height+'px'},600,function(){
field.appendTo

(ul).css('marginTop',0);
}) ;
});
});
</script>
<style type="text/css">
* { margin:0px; padding:0px;}
ul { width:200px; height:200px; border:1px solid #030;

position:relative; overflow:hidden;}
li { list-style:none; width:200px; height:200px; display:block;}
.scroll_btn { width:100px; height:20px; position:absolute;

background:#000; z-index:100}
.pre { left:10px; top:10px;}
.next { left:10px; bottom:10px;}
</style>
</head>

<body>
<ul>
<li style="background:red"></li>
<li style="background:green"></li>
<li style="background:blue"></li>
<li style="background:yellow"></li>
</ul>
</body>
</html>
记得:<script language="javascript" src="jquery.js"></script>
载入jquery工程 才能看效果

3、DW中如何制作这种图片循环滚动?

用代码:
基本代码如下:
<marquee direction="right" onmouseover="this.stop();" onmouseout="this.start();" >

<a href="http://www.baidu.com" target="_blank"><img src="1.jpg" border="1" /></a>
<img src="2.jpg" border="1" />
<img src="3.jpg" border="1" />

</marquee>

代码需要改进的很多,如果速度,及不间断显示
在链接的地方改成你的图片的位置。

4、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>

5、如何在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

希望对你有帮助。。(*^__^*)

6、制作网页中的滚动图片,怎样循环播放。

1.打开Dreamweaver创建新页面,如图:

2.插入如下代码,如图:

<!--最新图文代码开始-->
<%
set rs3=server.CreateObject("ADODB.RecordSet")
rs3.Source ="select top " & top_img & " * from "& db_News_Table &" where picnews=1 and checkked=1 and picname<>'null' order by NewsID DESC"
rs3.Open rs3.Source,conn,3,3
if not rs3.EOF Then
%>
<div align='center' id='demo' style='overflow:hidden;height:125px;width:990px;'><!--滚动区的高度和宽度-->
<table align='center' cellpadding='0' cellspace='0' border='0'>
<tr>
<td id='demo1' valign='top'>
<table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr valign='top'>
<%
while not rs3.EOF
fileExt=lcase(getFileExtName(rs3("picname")))
%>
<td align='center'>
<TABLE width=100% border=0 align=center cellPadding=0 cellSpacing=0>
<TR>
<TD width=8 rowspan=3 >&nbsp;</TD>
<TD vAlign=top width=8><img src='Images/bg_0ltop.gif' width=10 height=10></TD>
<TD background=images/bg_01.gif></TD>
<TD vAlign=top width=7><img src='Images/bg_0rtop.gif' width=10 height=10></TD>
<TD width=7 rowspan=3 vAlign=top>&nbsp;</TD>
</TR>
<TR>
<TD background='Images/bg_03.gif'>&nbsp;</TD>
<TD align="center" bgcolor="#E9E9E9">
<%if fileext="jpg" or fileext="bmp" or fileext="png" or fileext="gif" then%>
<table style="TABLE-LAYOUT: fixed" height=80 cellSpacing=0 cellPadding=0 width=105 border=0>
<tr>
<td style="HEIGHT: 80px">
<a class=middle href='ReadNews.asp?NewsID=<%=rs3("NewsID")%>' target=_blank title='<%=rs3("title")%>'><img  src='<%=FileUploadPath & rs3("picname")%>' width='105' border=0></a>
</td>
</tr>
</table>
<%else if fileext="swf" then%>
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='105' height='80'>
<param name=movie value='<%=FileUploadPath & rs3("picname")%>'>
<param name=quality value=high>
<param name='Play' value='-1'>
<param name='Loop' value='0'>
<param name='Menu' value='-1'>
<param name='wmode' value='transparent'>
<embed src='<%=FileUploadPath & rs3("picname")%>' width='105' height='80' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>
</object>
<a class=middle href='ReadNews.asp?NewsID=<%=rs3("NewsID")%>' target=_blank title='<%=rs3("title")%>'></a>
<%
end if
end If
%>
</TD>
<TD background='Images/bg_04.gif'>&nbsp;</TD>
</TR>
<TR>
<TD><img src='Images/bg_0lbottom.gif' width=10 height=10></TD>
<TD><img src='Images/bg_02.gif'></TD>
<TD><img src='Images/bg_0rbottom.gif' width=10 height=10></TD>
</TR>
<TR>
<TD>&nbsp;</TD>
<TD colspan=3 align=center height=20 valign='top' background='Images/bg_05.gif'>
<a class=middle href='ReadNews.asp?NewsID=<%=rs3("NewsID")%>' target=_blank title='<%=rs3("title")%>'><%=CutStr(htmlencode4(rs3("title")),14)%></a>
</TD>
<TD>&nbsp;</TD>
</TR>
</TABLE>
</td>
<%
rs3.MoveNext
wend
%>
</tr>
</table>
</td>
<td id=demo2 valign=top></td>
</tr>
</table>
</div>
<%if top_img >4 then%>
<script>
var speed=15
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,speed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</script>
<%
end if
else
Response.Write "暂 无 最 新 图 文"
end if
rs3.close
set rs3=nothing
%>
<!--最新图文代码结束-->

3.编写完成代码后查看预览效果图,如下:


注意事项:代码中select top " & top_img & " * from "& db_News_Table &" where picnews=1 and checkked=1 and picname<>'null' order by NewsID DESC"根据网站的数据库路径来定义数据表,包括ID编号的降序和顺序。

7、请问网页上的滚动图片怎么让他循环滚动

<div align='center' id='demo' style='overflow:hidden;height:130px;width:700px;'><!--滚动区的高度和宽度-->
<table align='center' cellpadding='0' cellspace='0' border='0'>
<tr>
<td id='demo1' valign='top'>

<table width="600" border="1" cellpadding="0" cellspacing="0" bgcolor="#FEFEE7" >
<tr>
<td height="3" colspan="9"></td>
</tr>

<tr>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img/bccx.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">白菜炒虾</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img/hdxr.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">滑蛋虾仁</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img2/wbhl.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">温拌海螺</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img/lbhs.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">凉拌海参</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img/lczt.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">老醋蛰头</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img/mgxh.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">木瓜雪哈</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img/stwwc.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">正汤嫩菜</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img2/yehx.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">云耳虾腰</div></td>
</tr>
</table></td>
<td width="7"></td>

<td><table width="87" border="0">
<tr>
<td><img src="img2/bczt.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">白菜蛰头</div></td>
</tr>
</table></td>
<td width="7"></td>
<td><table width="87" border="0">
<tr>
<td><img src="img2/wbhc.gif" width="87" height="87"></td>
</tr>
<tr>
<td><div align="center">温拌海肠</div></td>
</tr>
</table></td>
<td width="7"></td>

</tr>

</table>

</td>
<td id=demo2 valign=top></td>

</tr>
</table>
</div>

<script>
var Picspeed=15
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,Picspeed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,Picspeed)}
</script>
这个改一下,就行了

8、网页制作怎样让图片滚动?

网页图片无缝滚动实现代码:
<style type="text/css">
<!--
ul,li,div{margin:0; padding:0; font-size:12px;}
#demo {
width:678px; float:right; overflow:hidden;height:144px; border:none;
}
#indemo {
float: left;
width: 800%;
}
#demo1,#demo2{height:144px;float:left; display:inline-table;}
#demo1 li,#demo2 li{ width:127px; height:144px; float:left; padding-left:8px; }
#demo1 li img,#demo2 li img{ display:block; background:#ccc; padding:1px; border:1px solid #ccc;}
#demo1 li span,#demo2 li span{ width:127px; height:30px; line-height:30px; text-align:center; overflow:hidden;}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">
<ul>
<li><a href="#"><img src="http://boaer.comimg/temp01.gif" width="123" height="110" /></a><span><a href="#">产品名称</a></span></li>
<li><a href="#"><img src="http://boaer.comimg/temp02.gif" width="123" height="110" /></a><span><a href="#">产品名称</a></span></li>
<li><a href="#"><img src="http://boaer.comimg/temp03.gif" height="110" /></a><span><a href="#">产品名称</a></span></li>
</ul></div><div id="图片展示代码例子"></div></div></div><script>
<!--
var speed=20; //数字越大速度越慢
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></td>
</tr>
</table>

9、怎样才能让网页上的图片滚动循环

<div id="butong_net_right" style="overflow:hidden;width:1000px;">要注意width的值,这个值要比你要滚动的图片宽度总和小才可以,,在这里设设成<div id="butong_net_right" style="overflow:hidden;width:200px;">就可以了

10、网页制作如何让图片从左到右循环移动

网页制作(HTML)让图片从左到右循环移动使用 css +js完成。
例如:从左向右循环移动
<html>
<head><title>图片向右循环滚动</title><head>
<body>
<div id=demo style="overflow:hidden;height:68px;width:800px;"><table align=left cellpadding=0 cellspace=0 border=0><tr><td id=demo1 valign=top nowrap="nowrap">
<img src="http://www.newxing.com/skins/NewXing/logo.gif">
<img src="http://www.newxing.com/skins/NewXing/logo.gif">
<img src="http://www.newxing.com/skins/NewXing/logo.gif">
<img src="http://www.newxing.com/skins/NewXing/logo.gif">
</td><td id=demo2 valign=top></td></tr></table></div>
<script>
var speed = 30;
demo2.innerHTML = demo1.innerHTML;
function Marquee() {
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else {
demo.scrollLeft--;
}
};
var MyMar = setInterval(Marquee, speed);
demo.onmouseover = function() {
clearInterval(MyMar)
};
demo.onmouseout = function() {
MyMar = setInterval(Marquee, speed)
};
</SCRIPT>
</body>
</html>

与网页设计如何设置图片循环滚动相关的知识