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. Kafka consumer poll(long)与poll(Duration)的区别

    最近在StackOverflow碰到的一个问题,即在consumer.poll之后assignment()返回为空的问题,如下面这段代码所示: consumer.subscribe(Arrays.as ...

  2. Golang 笔记 1 基础、基本数据类型

    一.Go语言基础 1. 基础 Go语言中的标识符必须以字母(Unicode字母,PHP/JS可以用中文作为变量名)下划线开头.大写字母跟小写字母是不同的:Hello和hello是两个不同的名字.  G ...

  3. ubuntu14.04 terminator字体挤在一起问题

    字体挤在一起:在ubuntu下请选择mono后缀的字体就可以了 右键—>首选项—>profile—>general—>字体设置成ubuntu mono 或Free mono

  4. Golang知识图谱

    原:https://www.processon.com/view/link/5a9ba4c8e4b0a9d22eb3bdf0?from=timeline 百度脑图重制:http://naotu.bai ...

  5. MapReduce Map数 reduce数设置

    JobConf.setNumMapTasks(n)是有意义的,结合block size会具体影响到map任务的个数,详见FileInputFormat.getSplits源码.假设没有设置mapred ...

  6. threding模块的其他用法

    import threading import time def func(n): time.sleep(0.5) n += 1 print(n, threading.current_thread() ...

  7. window10安装composer

    第一步: 在https://getcomposer.org/download/页面下的Manual Download里下载最新的版本. 下载下来的是composer.phar文件,把这个文件放在你的p ...

  8. IkAnalyzer2012FF_u1.jar免费下载

    链接:https://pan.baidu.com/s/1P_0cdRLKJO4VIUTokvTS0g 提取码:qt3w

  9. NYOJ - 矩形嵌套(经典dp)

    矩形嵌套时间限制:3000 ms | 内存限制:65535 KB 描述 有n个矩形,每个矩形可以用a,b来描述,表示长和宽.矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b< ...

  10. spark streaming集成flume

    1. 安装flume flume安装,解压后修改flume_env.sh配置文件,指定java_home即可. cp hdfs jar包到flume lib目录下(否则无法抽取数据到hdfs上): $ ...