css样式

.bannerBox {position: relative;width: 100%;height: 348px;margin:0px auto;}
.bannerBox .bannerList {position: relative;width: 100%;height: 348px;overflow: hidden; text-align:center;}
.bannerList li {position: absolute;top: 0;left: 50%; margin-left:-1000px;width:2000px;height: 348px;}
#numList {position: absolute;left:50% ;bottom: 5px;}
#numList li {width: 15px;height: 15px;float: left;color: #fff;border-radius: 15px;background: #fff;text-align: center;margin-right: 5px;cursor: pointer; text-indent:-9999px;}
#numList li.curr {background: #F9A853;}
容器
<div id="bannerBox" class="bannerBox"></div>

<script type="text/javascript">
function bannerRun(container,num,imgUrl){
console.log(imgUrl)
$("#bannerBox").append($("<ul id='bannerList' class='bannerList'></ul>"))
for(var m =0;m<num;m++ ){
$("#bannerList").append($("<li>"+imgUrl[m]+"</li>"))
}
var t = n = 0, count;
count=$("#bannerList li").length;
$("#bannerList li:not(:first-child)").hide();
$("#bannerList").after( $('<ul id="numList"></ul>'));
for(i=1;i<=$("#bannerList li").length;i++){
if(i==1) $("#numList").append($("<li class=\"curr\">"+i+"</li>"));
else $("#numList").append($("<li>"+i+"</li>"));
}
$("#numList li").click(function() {
var i = $(this).text()-1;//获取Li元素内的值,即1,2,3
n = i;
if (i >= count) return;
$("#bannerList li").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
document.getElementById("bannerBox").style.background="";
$(this).toggleClass("curr");
$(this).siblings().removeAttr("class");
});
t = setInterval(function(){
showAuto();
}, 4000);
$("#bannerBox").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);});
function showAuto(){
n = n >=(count - 1) ? 0 : ++n;
$("#numList li").eq(n).trigger('click');
}
}

var imgUrl = ['<a href="messDetail.html" target="_blank"><img src="data:images/banner/banner01.png" width="2000" height="348"></a>',
'<a href="messDetail.html" target="_blank"><img src="data:images/banner/banner02.png" width="2000" height="348"></a>',
'<a href="messDetail.html" target="_blank"><img src="data:images/banner/banner03.png" width="2000" height="348"></a>'
]
bannerRun("#bannerBox",3,imgUrl);
</script>

jquery首页图片轮播的更多相关文章

  1. jQuery个性化图片轮播效果

    jQuery个性化图片轮播效果 购物产品展示:图片轮播器<效果如下所示> 思路说明: 每隔一段时间,实现图片的自动切换及选项卡选中效果,鼠标划入图片动画停止,划出或离开动画开始 两个区域: ...

  2. PgwSlideshow-基于Jquery的图片轮播插件

    0 PgwSlideshow简介 PgwSlideshow是一款基于Jquery的图片轮播插件,基本布局分为上下结构,上方为大图轮播区域,用户可自定义图片轮播切换的间隔时间,也可以通过单击左右方向按键 ...

  3. jQuery.YesShow - 图片轮播插件(带图片放大功能)

    jQuery.YesShow - 图片轮播插件(带图片放大功能) 使用简单,原文件只要这样就可以了:<div id="yes">         <ul> ...

  4. js实现淘宝首页图片轮播效果

    原文:http://ce.sysu.edu.cn/hope2008/Education/ShowArticle.asp?ArticleID=10585 <!DOCTYPE html> &l ...

  5. (转)jquery实现图片轮播

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. Javascript和jQuery WordPress 图片轮播插件, 内容滚动插件,前后切换幻灯片形式显示

    用于在有限的网页空间内展示一组产品图片或者照片,同时还有非常吸引人的动画效果.本文向大家推荐12款实用的 jQuery 图片轮播效果插件,帮助你在你的项目中加入一些效果精美的图片轮播效果,希望这些插件 ...

  7. 基于jquery的图片轮播 (IE8以上)

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  8. jQuery实现图片轮播

    之前有碰到过jQuery实现列表自动滚动,这次的图片轮播在原理上与之相同,只有一些细微的差别,就是需要在图片的右下角显示当前图片的序号,效果如下: 先看一看html代码,以及对应的css代码: < ...

  9. 原生js和jquery实现图片轮播特效

    本文给大家分享的是使用原生JS和JQ两种方法分别实现相同的图片轮播特效,十分的实用,也非常方便大家对比学习原生js和jQuery,有需要的小伙伴可以参考下. 1)首先是页面的结构部分对于我这种左右切换 ...

随机推荐

  1. 新版的 Springsecurity request.getRequestDispatcher).forward(request, response); 404 问题,已解决

    旧版本的 可以直接 转发登陆 request.getRequestDispatcher).forward(request, response); 新版本的转发会404,原因 SpringSecurit ...

  2. 阅历>感悟

    1.强扭的瓜不甜.在招聘的时候,面试官看不上你,你也不用赖着要去,你去能干好工作吗?面试官通常比你更清楚这个是事情.在比如谈恋爱,姑娘有更好的目标,不喜欢你了,决定离开你了,你再怎么挽留都是没意义的, ...

  3. JAVA课程课后作业03之动手动脑

    一.构造函数 问题一: 错误代码如图: 错误原因:从图片中的编译报错的地方来看,程序是在给新的对象分配空间是出现了问题,因而我们往下观察Foo类,Foo类的构造方法是有一个参数的有参方法,而前面构造新 ...

  4. ArcGIS AddIN异常:无法注册程序集 未能加载文件或程序集"ESRI.ArcGIS.Desktop.Addins"

    异常: 无法注册程序集“D:\CodeXX\bin\Debug\XX.dll”.未能加载文件或程序集“ESRI.ArcGIS.Desktop.AddIns, Version=10.1.0.0, Cul ...

  5. 关于微信里wx.getUserInfo获取用户信息都是拼音的转成中文方法

    加一个参数:lang:"zh_CN" 就可以了  1.  加在js里面 wx.getUserInfo({ lang:"zh_CN", success: func ...

  6. 剑指offer——python【第21题】栈的压入、弹出序列

    题目描述 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压 ...

  7. SQL 查询嵌套使用

    .查询: 各年级中 分数最高的学习信息   示例表如下:   create table it_student( id int primary key auto_increment,  -- 主键id ...

  8. JS — 获取4个不重复的随机验证码

    var strCode='zxcvbnmasdfghjklopiuytrewqAWEDRFTGYHUJIK'; var str=''; for(var i=0;i<4;i++){ var ran ...

  9. axios库的使用

    axios是基于Promise 用于浏览器和 nodejs 的 HTTP 客户端:可以用在webpack + vuejs 的项目中 原文 https://github.com/axios/axios ...

  10. redis3.0.3集群搭建

    redis3.0版本之后支持Cluster,具体介绍redis集群我就不多说,了解请看redis中文简介. 首先,直接访问redis.io官网,下载redis.tar.gz,现在版本3.0.3,我下面 ...