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. linux命令中的字符串中间增加指令,例如路径中增加日期变量,实时获取当前的日期

    `command` 倒引号 (backticks) 在前面的单双引号,括住的是字串,但如果该字串是一列命令列,会怎样?答案是不会执行.要处理这种情况,我们得用倒单引号来做.fdv=`date +%F` ...

  2. MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report e

    早上来到公司,线上的项目报错: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionExcepti ...

  3. Codeforces Round #531 (Div. 3)

    A:瞎猜. #include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); i ...

  4. 严重: A child container failed during start的问题解决方法

    找到tomcat中的server.xml中的文件, 将图中阴影的部分注释掉,即可.

  5. PM2.5环境检测系统的设计与分析

    PM2.5环境检测系统的设计与分析   摘要: 大气颗粒物污染对人类健康和生态环境造成了很大的影响,这让人们逐渐重视起对细颗粒物PM2.5检测技术的研究.本文阐述了PM2.5浓度检测的五种方法,在对上 ...

  6. httpClient实例--返回响应部分并且转换成对象

    import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.InputStream;import ja ...

  7. jsignature 中文开发手册

    2017年5月9日21:23:17,最近比较忙,没时间写博客,真的是越来越懒来了 github:https://github.com/brinley/jSignature http://www.unb ...

  8. Linux:dd命令

    dd:“data duplicator” 意为数据复印机,它可以用来拷贝和转换数据. 备份和恢复整个硬盘或分区 备份MBR(主引导记录) 在ASCII和EBCDIC格式之间转换 也可以为Linux内核 ...

  9. ExceptionLess使用

    1.os使用windows server 2012,省的升级iis express-iis 8(测试环境是IIS Express 8,生产环境IIS 7.5).PowerShell 3+了. 2.wi ...

  10. Xcode工程编译错误之iOS开发之Sending '__strong typeof (xxx)' (aka 'xxxx *__strong') to parameter of incompatible type 'id<xxx>'

    iphone开发出现警告: Sending '__strong typeof (xxx)' (aka 'xxxx *__strong') to parameter of incompatible ty ...