zoukankan
html css js c++ java
网站首页js幻灯片代码
JS图片幻灯片,网站首页专用的图片特效代码,旅游网站用着最合适了,支持图片说明,每一幅图片都可以加标题和简短的文字介绍,右下角有图片切换控制按钮,示例中仅有5张图片,不过在实际应用中,你可以添加更多的图片。 <!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>JS图片幻灯片</title> <style> *{margin:0;padding:0;} ul,li,ol{ list-style:none;} img,a img{ border:none;} table{ border-collapse:collapse; border-spacing:0;} em,i,u{ font-style:normal;} a{ text-decoration:none;color:#434343;} a:hover{ text-decoration:underline; color:#ff4000;} body{font-size:12px; font-family:"宋体";color:#434343;} .clear{clear:both; font-size:0; overflow:hidden; height:0;} .blank10{clear:both; font-size:0; overflow:hidden; height:10px;} .blank{clear:both; font-size:0; overflow:hidden; height:10px; background:#FFF;} /*********content css定义***********/ #content{960px;margin:0 auto;} h1,h2,h3{ font-family:"微软雅黑";color:#00659b;} h1,h2,h3,h4,h5,h6{ font-weight:bold;} #footer{padding-bottom:0;margin:0px auto 0;} /*********main css定义***********/ .mb15 {margin-bottom: 0px;} #main{960px; margin:6px auto 10px; overflow:hidden;} /*********图片切换 css定义***********/ .sub_box{663px; height:310px; float:left; position:relative; overflow:hidden; border:1px solid #cccccc; background:url() center center no-repeat; *background:url() 220px 120px no-repeat;} .sub_box img{border:none; 663px; height:310px;} #bd1lfimg{position:relative; 663px; height:310px; overflow:hidden;} #bd1lfimg div{100000px; margin-left:-4px;} #bd1lfimg dl{663px; height:310px; position:relative; overflow:hidden; float:left;} #bd1lfimg dt{663px; height:310px; position:absolute; left:0px; top:0px;} #bd1lfimg dd{623px; height:80px; background:#000000; filter:alpha(Opacity=70); Opacity:0.7; position:absolute; left:0px; bottom:0px; padding:0 20px;} #bd1lfimg dd h2{height:25px; padding:8px 0 4px 0; line-height:25px; overflow:hidden;} #bd1lfimg dd h2 a{font-size:14px; font-weight:bold; color:#ffffff;} #bd1lfimg dd a{color:#ffffff; text-decoration:none;} #bd1lfimg dd a:hover{text-decoration:none; color:#cccccc;} #bd1lfimg dd tt{color:#dddddd; line-height:1.2em;} #bd1lfimg dd tt a:hover{text-decoration:underline;} .sub_nav{663px; height:25px; bottom:0px; position:absolute; color:#999999; z-index:200;} .sub_no{height:25px; float:right;} .sub_no li{display:block; 25px; height:25px; float:left; overflow:hidden; line-height:25px; vertical-align:middle; text-align:center; background:#000000; filter:alpha(Opacity=70); Opacity:0.7; font-family:Arial; font-size:11px; color:#999999; cursor:pointer;} .sub_no li.show{background:#ffffff; color:#000000;} .sub_more{float:right; 50px; height:25px; background:#000000; filter:alpha(Opacity=70); Opacity:0.7; color:#999999; text-align:center; line-height:25px;} .sub_more a{color:#999999;} .sub_more a:hover{color:#cccccc; text-decoration:none;} </style> <script type="text/javascript"> //选择器 function $a(id,tag){var re=(id&&typeof id!="string")?id:document.getElementById(id);if(!tag){return re;}else{return re.getElementsByTagName(tag);}} //焦点滚动图 点击移动 function movec() { var o=$a("bd1lfimg",""); var oli=$a("bd1lfimg","dl"); var oliw=oli[0].offsetWidth; //每次移动的宽度 var ow=o.offsetWidth-2; var dnow=0; //当前位置 var olf=oliw-(ow-oliw+10)/2; o["scrollLeft"]=olf+(dnow*oliw); var rqbd=$a("bd1lfsj","ul")[0]; var extime; <!--for(var i=1;i<oli.length;i++){rqbd.innerHTML+="<li>"+i+"</li>";}--> var rq=$a("bd1lfsj","li"); for(var i=0;i<rq.length;i++){reg(i);}; oli[dnow].className=rq[dnow].className="show"; var wwww=setInterval(uu,2000); function reg(i){rq[i].onclick=function(){oli[dnow].className=rq[dnow].className="";dnow=i;oli[dnow].className=rq[dnow].className="show";mv();}} function mv(){clearInterval(extime);clearInterval(wwww);extime=setInterval(bc,15);wwww=setInterval(uu,8000);} function bc() { var ns=((dnow*oliw+olf)-o["scrollLeft"]); var v=ns>0?Math.ceil(ns/10):Math.floor(ns/10); o["scrollLeft"]+=v;if(v==0){clearInterval(extime);oli[dnow].className=rq[dnow].className="show";v=null;} } function uu() { if(dnow<oli.length-2) { oli[dnow].className=rq[dnow].className=""; dnow++; oli[dnow].className=rq[dnow].className="show"; } else{oli[dnow].className=rq[dnow].className="";dnow=0;oli[dnow].className=rq[dnow].className="show";} mv(); } o.onmouseover=function(){clearInterval(extime);clearInterval(wwww);} o.onmouseout=function(){extime=setInterval(bc,15);wwww=setInterval(uu,8000);} } </script> </head> <body> <!-------- content start ---------> <div id="content"> <!-- ===================== header end ===================== --> <!--------main begin---------> <div id="main"> <!-----------图片切换 begin-----------> <div class="sub_box"> <div id="p-select" class="sub_nav"> <div class="sub_more"><a href="/" onfocus="this.blur()" title="查看更多目的地旅游指南" style="font-family: Tahoma; font-size: 12px;" target="_blank">更多>></a></div> <div class="sub_no" id="bd1lfsj"> <ul> <li class="show">1</li><li class="">2</li><li class="">3</li><li class="">4</li><li class="">5</li> </ul> </div> </div> <div id="bd1lfimg"> <div> <dl class="show"></dl> <dl class=""> <dt><a href="http://www.codefans.net" title="" target="_blank"><img src="http://www.codefans.net/jscss/demoimg/wall1.jpg" alt="2011城市主题公园亲子游"></a></dt> <dd> <h2><a href="#" target="_blank">2011城市主题公园亲子游</a></h2> <tt><a href="#" target="_blank">又是春游踏青的季节,各大主题乐园都为大朋友、小朋友们准备了丰…</a></tt> </dd> </dl> <dl class=""> <dt><a href="#" title="" target="_blank"><img src="http://www.codefans.net/jscss/demoimg/wall2.jpg" alt="潜入城市周边清幽之地"></a></dt> <dd> <h2><a href="#" target="_blank">潜入城市周边清幽之地</a></h2> <tt><a href="#" target="_blank">北京、上海、广州、成都周边,总有些人少清幽的地方,等着你去探…</a></tt> </dd> </dl> <dl class=""> <dt><a href="#" title="" target="_blank"><img src="http://www.codefans.net/jscss/demoimg/wall3.jpg" alt="盘点中国最美雪山"></a></dt> <dd> <h2><a href="#" target="_blank">盘点中国最美雪山</a></h2> <tt><a href="#" target="_blank">盘点中国最美雪山,从云南的梅里到西藏的珠穆朗玛,带你领略中国…</a></tt> </dd> </dl> <dl class=""> <dt><a href="#" title="" target="_blank"><img src="http://www.codefans.net/jscss/demoimg/wall4.jpg" alt="2011西安世园会攻略"></a></dt> <dd> <h2><a href="http://www.codefans.net/" target="_blank">2011西安世园会攻略</a></h2> <tt><a href="#" target="_blank">提供最全面西安世园会资讯、西安世园会参观指南、西安世园会旅游…</a></tt> </dd> </dl> <dl class=""> <dt><a href="http://www.codefans.net/" title="" target="_blank"><img src="http://www.codefans.net/jscss/demoimg/wall5.jpg" alt="五月乐享懒人天堂塞班岛"></a></dt> <dd> <h2><a href="http://www.codefans.net/jscss/" target="_blank">五月乐享懒人天堂塞班岛</a></h2> <tt><a href="#" target="_blank">塞班岛是北马里亚纳群岛的首府,由于近邻赤道,塞班岛一年四季如…</a></tt> </dd> </dl> </div> </div> </div> <script type="text/javascript">movec();</script> <!-----------图片切换 end-----------> </div> <!--------main end---------> </div> </body> </html>
欢迎转载,转载请注明出处。本文出自:
http://www.cnblogs.com/zdcaolei
0
查看全文
相关阅读:
python编写弹球游戏的实现代码
Linux kernal
ccc
Ubuntu14.04 支持 exFat 格式操作
Ubuntu 14.04 tar 打包系统安装到新机器
Ubuntu14.04 dd命令克隆系统镜像安装到另一台机器上
gzip 的使用
gzip: stdin: unexpected end of file tar: Unexpected EOF in archive
c++ 实现等待5s
Ubuntu14.04 系统复制迁移到新的机器上
原文地址:https://www.cnblogs.com/zdcaolei/p/2122930.html
最新文章
OkHttpUtils
在AndroidStudio中引入SlidingMenu第三方库的步骤
android语言适配
ERRORS: ?: (corsheaders.E013) Origin '*' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT:
解决“cv2.error: OpenCV(3.4.2) C:projectsopencv-pythonopencvmoduleshighguisrcwindow.cpp:356:...”
python安装cv2
tesseract 安装及使用
python 安装 pytesseract
无线路由器桥接上网方案
Ubuntu 14.04 网卡网关配置修改
热门文章
Ubuntu 14.04 64bit中永久添加DNS的方法
vim 操作命令
Ubuntu 14.04 用户操作
Ubuntu14.04 gzip failed file too large
ubuntu 14.04 安装ntp
Smali基础知识
使用apktool工具遇到 could not decode arsc file 的解决办法
python 小游戏 “外星飞船入侵”
libpng warning:iCCP:known incorrect sRGB profile
Python GUI编程
Copyright © 2011-2022 走看看