js、jquery图片动画、动态切换示例代码


Posted in Javascript onJune 03, 2014
<style type="text/css"> 
#banner 
{ 
padding: 5px; 
position: relative; 
width: 968px; 
height: 293px; /*border: 1px solid #666;*/ 
overflow: hidden; 
font-size: 16px; 
} 
#banner_list img 
{ 
border: 0px; 
} 
#banner_bg 
{ 
margin-bottom: 5px; 
position: absolute; 
bottom: 0; 
background-color: #000; 
height: 30px; 
filter: Alpha(Opacity=30); 
opacity: 0.3; 
z-index: 1000; 
cursor: pointer; 
width: 968px; 
} 
#banner_info 
{ 
position: absolute; 
bottom: 4px; 
left: 0px; 
height: 22px; 
color: #fff; 
z-index: 1001; 
cursor: pointer; 
} 
#banner_text 
{ 
position: absolute; 
width: 120px; 
z-index: 1002; 
right: 3px; 
bottom: 3px; 
} 
#banner ul 
{ 
position: absolute; 
list-style-type: none; 
filter: Alpha(Opacity=80); 
opacity: 0.8; 
z-index: 1002; 
margin: 0; 
padding: 0; 
bottom: 10px; 
right: 5px; 
height: 20px; 
} 
#banner ul li 
{ 
padding: 0 8px; 
line-height: 18px; 
float: left; 
display: block; 
color: #FFF; 
border: #e5eaff 1px solid; 
background-color: #6f4f67; 
cursor: pointer; 
margin: 0; 
font-size: 16px; 
} 
#banner_list a 
{ 
/* position: absolute;*/ 
width: 968px; 
height: 293px; 
margin: 0px; 
padding: 0px; 
} 
#banner_list 
{ 
margin: 0px; 
padding: 0px; 
width: 968px; 
height: 293px; 
border: #e7e7e7 1px solid; 
} 
</style>

<script type="text/javascript"> 
var t = n = 0, count; 
$(function () { 
count = $("#banner_list a").length; 
$("#banner_list a:not(:first-child)").hide(); 
$("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt')); 
$("#banner_info").click(function () { window.open($("#banner_list a:first-child").attr('href'), "_blank") }); 
$("#banner li").click(function () { 
var i = $(this).text() - 1; //获取Li元素内的值,即1,2,3,4 
n = i; 
if (i >= count) return; 
$("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt')); 
$("#banner_info").unbind().click(function () { window.open($("#banner_list a").eq(i).attr('href'), "_blank") }) 
$("#banner_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000); 
$(this).css({ "background": "#be2424", 'color': '#000' }).siblings().css({ "background": "#6f4f67", 'color': '#fff' }); 
}); 
t = setInterval("showAuto()", 4000); 
$("#banner").hover(function () { clearInterval(t) }, function () { t = setInterval("showAuto()", 4000); });//4秒钟切换一张图片}); 
function showAuto() { 
n = n >= (count - 1) ? 0 : ++n; 
$("#banner li").eq(n).trigger('click'); 
} 
</script>

<div id="banner"> 
<div id="banner_bg"> 
</div> 
<!--标题背景--> 
<div id="banner_info"> 
</div> 
<!--标题--> 
<ul> 
<li>1</li> 
<li>2</li> 
<li>3</li> 
<li>4</li> 
</ul> 
<div id="banner_list"> 
<a href='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgoneURL"]:""%>' target="_blank"> 
<img src='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgone"]:"Images/Singapore.jpg"%>' 
title="" alt="" width="968px" height="293px" border="0" /></a> <a href='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgtowURL"]:""%>' 
target="_blank"> 
<img src='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgtow"]:"Images/Malaysia.jpg"%>' 
title="" alt="" width="968px" height="293px" border="0" /></a> <a href='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgthreeURL"]:""%>' 
target="_blank"> 
<img src='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgthree"]:"Images/HongKong.jpg"%>' 
title="" alt="" width="968px" height="293px" border="0" /></a> 
<a href='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgfourURL"]:""%>' target="_blank"> 
<img src='<%:DicFlashImg!=null?DicFlashImg["PFI_FlashImgfour"]:"Images/flash4.jpg"%>' 
title="" alt="" width="968px" height="293px" border="0" /></a> 
</div> 
</div>
Javascript 相关文章推荐
jQuery 1.5 源码解读 面向中高阶JSER
Apr 05 Javascript
jQuery EasyUI API 中文文档 - NumberSpinner数值微调器使用介绍
Oct 21 Javascript
详解参数传递四种形式
Jul 21 Javascript
JS闭包与延迟求值用法示例
Dec 22 Javascript
在node.js中怎么屏蔽掉favicon.ico的请求
Mar 01 Javascript
JS组件系列之Gojs组件 前端图形化插件之利器
Nov 29 Javascript
微信小程序websocket实现聊天功能
Mar 30 Javascript
基于Vue实现关键词实时搜索高亮显示关键词
Jul 21 Javascript
基于JavaScript实现瀑布流布局
Aug 15 Javascript
微信小程序—setTimeOut定时器的问题及解决
Jul 26 Javascript
微信小程序定义和调用全局变量globalData的实现
Nov 01 Javascript
vue+node 实现视频在线播放的实例代码
Oct 19 Javascript
jquery css 设置table的奇偶行背景色示例
Jun 03 #Javascript
js,jquery滚动/跳转页面到指定位置的实现思路
Jun 03 #Javascript
jquery浏览器滚动加载技术实现方案
Jun 03 #Javascript
js控制当再次点击按钮时的间隔时间
Jun 03 #Javascript
node.js中使用node-schedule实现定时任务实例
Jun 03 #Javascript
node.js WEB开发中图片验证码的实现方法
Jun 03 #Javascript
node.js实现多图片上传实例
Jun 03 #Javascript
You might like
win2003服务器使用WPS的COM组件的一些问题解决方法
2012/01/11 PHP
解析CI的AJAX分页 另类实现方法
2013/06/27 PHP
分享一个php 的异常处理程序
2014/06/22 PHP
最新制作ThinkPHP3.2.3完全开发手册
2015/11/23 PHP
CodeIgniter开发实现支付宝接口调用的方法示例
2016/11/14 PHP
php 数据结构之链表队列
2017/10/17 PHP
实例讲解PHP中使用命名空间
2019/01/27 PHP
JavaScript isPrototypeOf和hasOwnProperty使用区别
2010/03/04 Javascript
6个DIV 135或246间隔一秒轮番显示效果
2010/07/24 Javascript
javascript是怎么继承的介绍
2012/01/05 Javascript
JavaScript去除空格的三种方法(正则/传参函数/trim)
2013/02/06 Javascript
JS 实现导航栏悬停效果(续2)
2013/09/24 Javascript
jQuery自定义事件的简单实现代码
2014/01/27 Javascript
使用jQuery时Form表单元素ID和name命名大忌
2014/03/06 Javascript
jquery实现通用版鼠标经过淡入淡出效果
2014/06/15 Javascript
jQuery实现平滑滚动到指定锚点的方法
2015/03/20 Javascript
javascript每日必学之运算符
2016/02/16 Javascript
BootStrap 轮播插件(carousel)支持左右手势滑动的方法(三种)
2016/07/07 Javascript
通过jquery实现页面的动画效果(实例代码)
2016/09/18 Javascript
JS添加或修改控件的样式(Class)实现方法
2016/10/15 Javascript
原生js实现网易轮播图效果
2020/04/10 Javascript
bootstrap模态框嵌套、tabindex属性、去除阴影的示例代码
2017/10/17 Javascript
解决在vue项目中,发版之后,背景图片报错,路径不对的问题
2018/03/06 Javascript
JavaScript创建、读取和删除cookie
2019/09/03 Javascript
解决layer 动态加载select 失效的问题
2019/09/18 Javascript
在SSM框架下用laypage和ajax实现分页和数据交互的方法
2019/09/27 Javascript
vue的hash值原理也是table切换实例代码
2020/12/14 Vue.js
Python读取视频的两种方法(imageio和cv2)
2018/04/15 Python
浅析Python 读取图像文件的性能对比
2019/03/07 Python
python redis 批量设置过期key过程解析
2019/11/26 Python
Python单链表原理与实现方法详解
2020/02/22 Python
Python实现王者荣耀自动刷金币的完整步骤
2021/01/22 Python
浅谈CSS3特性查询(Feature Query: @supports)功能简介
2017/07/31 HTML / CSS
澳大利亚家具和家居用品购物网站:Zanui
2018/12/29 全球购物
授权委托书
2015/01/28 职场文书
三峡人家导游词
2015/01/31 职场文书