导航:首页 > 万维百科 > 网页设计如何制作图片轮换展示

网页设计如何制作图片轮换展示

发布时间:2021-03-27 15:07:50

1、如何用只用html 制作图片轮播效果?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="zh" lang="zh">
<head>
<title>完全利用CSS实现图片切换特效_网页代码站()</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<style>
dl { position:absolute;width:240px;height:170px;border:10px solid #eee; }
dd { margin:0;width:240px;height:170px;overflow:hidden; }
img { border:1px solid black }
dt { position:absolute;right:3px;top:50px; }
a { display:block;margin:1px;width:20px;height:20px;text-align:center;font:700 12px/20px "宋体",sans-serif;color:#fff;text-decoration:none;background:#666;border:1px solid #fff;filter:alpha(opacity=40);opacity:.4; }
a:hover {background:#000}
</style>
</head>
<body>
<dl$amp;>amp;$lt;dt$amp;>amp;$lt;a #a" title="">1</a>
<a #b" title="">2</a>
<a #c" title="">3</a>
</dt>
<dd$amp;>amp;$lt;img src="" alt="" id="a" />
<img src="" alt="" id="b" />
<img src="" alt="" id="c" />
</dd>
</dl>
</body>
</html>

2、网页里要如何实现轮换几张图片

的dw的层的时间轴就可以控制了。,这种你可以做成的

3、网页制作是如何实现图片切换的?

新建项目文件夹如下图所示

编写index.html文件,代码如下:

<DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<title>

lunbo

</title>

<link href="css/style.css" rel="stylesheet"/>

<script src="js/lunbo.js">

</script>

</head>

<body>

<div id="container">

<div id="list" style="left:-600px;">

<img src="images/5.jpg" alt="5.pg"/>

<img src="images/1.jpg" alt="5.pg"/>

<img src="images/2.jpg" alt="5.pg"/>

<img src="images/3.jpg" alt="5.pg"/>

<img src="images/4.jpg" alt="5.pg"/>

<img src="images/5.jpg" alt="5.pg"/>

<img src="images/1.jpg" alt="5.pg"/>

</div>

<div id="buttons">

<span index="1"class="on"> </span>

<span index="2"></span>

<span index="3"></span>

<span index="4"></span>

<span index="5"></span>

</div>

<a href="javascript:;" class="arrow" id="prev">&lt;</a>

<a href="javascript:;" class="arrow" id="next">&gt;</a>

</div>

</body>

</html>

编写style.css文件,代码如下:

*{ margin:0px; text-decoration:none;}

body{margin-top:50px;}

#container{width:600px; height:400px; position:relative;border:3px solid #333;overflow:  hidden; margin:0 auto;}

#list{width:4200px; height:400px; position:absolute; z-index:1;}

#list img{float:left;}

#buttons{position:absolute; height:10px; width:100px; z-index:2; bottom:20px; left:250px;}

#buttons span{cursor:pointer;/*假超链接样式*/ float:left; border:1px  solid #fff; width:10px; height:10px; border-radius:10px; background:#333; margin-right:5px;}

#buttons .on{background:orangered;}

.arrow{cursor:pointer; display:none; line-height:39px; text-align:center; font-size:36px; 

font-weight:bold; width:40px; height:40px;  position:absolute; z-index:2; top:180px;

background-color: RGBA(0,0,0,.3); color:#fff;}

.arrow:hover{background-color:RGBA(0,0,0,.7);}

#container:hover .arrow{display:block;}

#prev{left:20px;}

#next{right:20px;}

编写control.js文件代码如下

window.onload=function(){

var container=document.getElementById('container');

var list=document.getElementById('list');

var buttons=document.getElementById('buttons').getElementsByTagName('span');

var pre=document.getElementById('prev');

var next=document.getElementById('next');

var index=1;

var animated=false;

var timer;

function showButton(){

for(var i=0;i<buttons.length;i++){

if(buttons[i].className=='on'){

buttons[i].className='';

break;

}

}

buttons[index-1].className="on";

}

function animate(offset){

animated=true;

var newleft=parseInt(list.style.left)+offset;

var time=300;//位移总时间

var interval=10;//位移间隔时间

var speed=offset/(time/interval);//每一次的位移量

function go(){

if((speed<0&&parseInt(list.style.left)>newleft)||(speed>0&&parseInt(list.style.  left)<newleft)){

list.style.left=parseInt(list.style.left)+speed+'px';

setTimeout(go,interval);

}

else{

animated=false;

list.style.left=newleft+'px';

if(newleft>-600){

list.style.left=-3000+'px'; 

}

if(newleft<-3000){

list.style.left=-600+'px'; 

}

}

}

go();

}

function play(){

timer=setInterval(function(){

next.onclick();

},3000);

}

function stop(){

clearInterval(timer);

}

next.onclick=function(){

if(index==5){

index=1;

}

else{

index+=1;

}

showButton();

if(animated==false){

animate(-600);

}

}

pre.onclick=function(){

if(index==1){

index=5;

}

else{

index-=1;

}

showButton();

if(animated==false){

animate(600);

}

}

for(var i=0;i<buttons.length;i++){

buttons[i].onclick=function(){

if(this.className=='on'){

return;

}

var myIndex=parseInt(this.getAttribute('index'));

var offset=-600*(myIndex-index);

index=myIndex;

showButton();

if(animated==false){

animate(offset);

}

}

}

container.onmouseover=stop;

container.onmouseout=play;

play();

}

images文件的图片截图如下

运行效果截图如下:

4、网页设计html图片切换怎么做到的?

图片切换要用到JAVASCRIPT技术了,不知道楼主学了没,但是javascript做起来会比较困难,用jquery来做就会简单很多,里面封装了许多方法

5、网页图片轮换制作全过程

以下是4张图片轮换的效果,把里面的中文改成相应的内容,保存成html或其他网页格式就能看到效果,希望能帮到您

<table width="410" height="136" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f4f4f4">

  <tr>

    <td><script language=JavaScript>

var elady_step=3; //1:small, 3:middle, 5:big

var elady_speed=50; //20:fast, 50:middle, 80:slow

var e_tp=new Array();

var e_tplink=new Array();

var adNum_elady1=0;  

var elady_stop_sh=0;

var elady_star_sh=1;

function elady1_moveImg(){

if ((!document.all&&!document.getElementById)||(elady_stop_sh==0)) return;

if (elady_star_sh==1){

document.all.elady1_divimg.style.pixelTop=parseInt(document.all.elady1_divimg.style.pixelTop)+elady_step;}

else if (elady_star_sh==2){

document.all.elady1_divimg.style.pixelLeft=parseInt(document.all.elady1_divimg.style.pixelLeft)+elady_step;}

else if (elady_star_sh==3){

document.all.elady1_divimg.style.pixelTop=parseInt(document.all.elady1_divimg.style.pixelTop)-elady_step;}

else{

document.all.elady1_divimg.style.pixelLeft=parseInt(document.all.elady1_divimg.style.pixelLeft)-elady_step;}

if (elady_star_sh<4) elady_star_sh++;

else elady_star_sh=1;

setTimeout("elady1_moveImg()",elady_speed);}

e_tplink[0]="改成您要转到的网址1/";

e_tp[0]="改成您的图片1";

e_tplink[1]="改成您要转到的网址2/";

e_tp[1]="改成您的图片2";

e_tplink[2]="改成您要转到的网址3/";

e_tp[2]="改成您的图片3";

e_tplink[3]="改成您要转到的网址4/";

e_tp[3]="改成您的图片4";

var currentimage=new Array();   

for (i=0;i<=3;i++){currentimage[i]=new Image();

      currentimage[i].src=e_tp[i];

         }

         function elady1_set(){   if (document.all)

         {      e_tprotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);

               e_tprotator.filters.revealTrans.apply();   }

               }

               function elady1_playCo()

               {   if (document.all)      e_tprotator.filters.revealTrans.play()

               }function elady1_nextAd(){   if(adNum_elady1<e_tp.length-1)adNum_elady1++ ;

                     else adNum_elady1=0;

                        elady1_set();

                           document.images.e_tprotator.src=e_tp[adNum_elady1];

                              elady1_playCo();

                                 theTimer=setTimeout("elady1_nextAd()", 4000);}

                                 function elady1_linkurl(){   jumpUrl=e_tplink[adNum_elady1];

                                    jumpTarget='_blank';

                                       if (jumpUrl != ''){      if (jumpTarget != '')window.open(jumpUrl,jumpTarget);

                                             else location.href=jumpUrl;

                                                }}

function elady1_listMsg() 

{   status=e_tplink[adNum_elady1];

document.returnValue = true;}

document.write("<div id='elady1_divimg' style='position:relative'>");

document.write('<a onMouseOver="elady1_listMsg();return document.returnValue" href="javascript:elady1_linkurl()" target="_self">');

document.write('<img style="FILTER: revealTrans(ration=2,transition=20)" height=136 src="javascript:elady1_nextAd()" width=410 border=0 name=e_tprotator ></a>');

document.write("</div>");

    </script></td>

  </tr>

</table>

6、html网页里图片轮换效果是怎么制作.

呵呵,这种效果网上有专门的模板的

不过一般是ASP的,可能HTML是做好以后

自动生成的,

7、请问怎么在制作网页上插入图片轮播?

<!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>pic player</title>
<script type="text/javascript" src="http://img.jb51.net/jslib/jquery/jquery-1.2.6.js"></script>
<script type="text/javascript" src="http://img.jb51.net/jslib/jquery/tween.js"></script>
</head>
<style type="text/css">
img{border:0;}
</style>
<body>
<div id="picplayer" style="position:relative;overflow:hidden;width:300px;height:300px;clear:none;border:solid 1px #ccc;">
there is a pic-player
</div>
<script>
var p = $('#picplayer');
var pics1 = [{url:'http://img.jb51.net/online/picPlayer/1.jpg',link:'http://www.jb51.net/#',time:5000},{url:'http://img.jb51.net/online/picPlayer/2.jpg',link:'http://www.jb51.net/#',time:4000},{url:'http://img.jb51.net/online/picPlayer/3.jpg',link:'http://www.jb51.net',time:6000},{url:'http://img.jb51.net/online/picPlayer/2.jpg',link:'http://www.jb51.net',time:6000},{url:'http://img.jb51.net/online/picPlayer/1.jpg',link:'http://www.jb51.net',time:6000}];
initPicPlayer(pics1,p.css('width').split('px')[0],p.css('height').split('px')[0]);
//
//
function initPicPlayer(pics,w,h)
{
//选中的图片
var selectedItem;
//选中的按钮
var selectedBtn;
//自动播放的id
var playID;
//选中图片的索引
var selectedIndex;
//容器
var p = $('#picplayer');
p.text('');
p.append('<div id="piccontent"></div>');
var c = $('#piccontent');
for(var i=0;i<pics.length;i++)
{
//添加图片到容器中
c.append('<a href="'+pics[i].link+'" target="_blank"><img id="picitem'+i+'" style="display: none;z-index:'+i+'" src="'+pics[i].url+'" /></a>');
}
//按钮容器,绝对定位在右下角
p.append('<div id="picbtnHolder" style="position:absolute;top:'+(h-25)+'px;width:'+w+'px;height:20px;z-index:10000;"></div>');
//
var btnHolder = $('#picbtnHolder');
btnHolder.append('<div id="picbtns" style="float:right; padding-right:1px;"></div>');
var btns = $('#picbtns');
//
for(var i=0;i<pics.length;i++)
{
//增加图片对应的按钮
btns.append('<span id="picbtn'+i+'" style="cursor:pointer; border:solid 1px #ccc;background-color:#eee; display:inline-block;"> '+(i+1)+' </span> ');
$('#picbtn'+i).data('index',i);
$('#picbtn'+i).click(
function(event)
{
if(selectedItem.attr('src') == $('#picitem'+$(this).data('index')).attr('src'))
{
return;
}
setSelectedItem($(this).data('index'));
}
);
}
btns.append(' ');
///
setSelectedItem(0);
//显示指定的图片index
function setSelectedItem(index)
{
selectedIndex = index;
clearInterval(playID);
//alert(index);
if(selectedItem)selectedItem.fadeOut('fast');
selectedItem = $('#picitem'+index);
selectedItem.fadeIn('slow');
//
if(selectedBtn)
{
selectedBtn.css('backgroundColor','#eee');
selectedBtn.css('color','#000');
}
selectedBtn = $('#picbtn'+index);
selectedBtn.css('backgroundColor','#000');
selectedBtn.css('color','#fff');
//自动播放
playID = setInterval(function()
{
var index = selectedIndex+1;
if(index > pics.length-1)index=0;
setSelectedItem(index);
},pics[index].time);
}
}

</script>
</body>
</html>

详细出处参考:http://www.jb51.net/article/17008.htm

8、制作网页怎样做图片切换效果?最好详细代码!

效果主要做的是无缝切换图片:
<style>
*{ margin:0; padding:0; list-style:none;}
#box{ width:840px; border:1px solid #000; height:210px; margin:30px auto; position:relative; overflow:hidden;}
#box ul{ position:absolute; left:0; top:0;}
#box ul li{ width:200px; height:200px; float:left; padding:5px;}
</style>
<script>
window.onload=function(){
var oBox=document.getElementById('box');
var oUl=oBox.children[0];
var aLi=oUl.children;

//复制一份内容 ,制作出无缝的效果
oUl.innerHTML+=oUl.innerHTML;
oUl.style.width=aLi.length*aLi[0].offsetWidth+'px';

setInterval(function(){ //开定时器,这样就可以自己切换,无需人工干预。
var l=oUl.offsetLeft-10; //图片切换,就是移动距离
if(l<=-oUl.offsetWidth/2){
l=0;
}
oUl.style.left=l+'px';
},30);
};
</script>
</head>
<body>
<div id="box">
<ul>
<li><img src="img/1.jpg" width="200"></li>
<li><img src="img/2.jpg" width="200"></li>
<li><img src="img/3.jpg" width="200"></li>
<li><img src="img/4.jpg" width="200"></li>
</ul>
</div>

9、网页设计中如何实现图片的自动切换,好想动画效果似的,但不是插入的视频,如下图所示

试试这个图片轮播
有12345数字一起切换
有小图大图一起切换
里面有教程和源码

与网页设计如何制作图片轮换展示相关的知识