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"><</a>
<a href="javascript:;" class="arrow" id="next">></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數字一起切換
有小圖大圖一起切換
裡面有教程和源碼