1 <!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JQ轮播图,图片可调用,自动+鼠标点击切换</title>
<script src="jquery-1.11.1.js"></script>
<style>
body,ul,ol,li,img{margin:0;padding:0;}
ul,ol,li{list-style:none;}
img{vertical-align:top;}
#img_box{width:470px;height:150px;margin:30px auto;position:relative;overflow: hidden;}
#img_box ul{position:absolute;top:0;left:0;z-index:1;}
#img_box ol{position:absolute;bottom:15px;right:15px;z-index:2;}
#img_box ol li{display:inline-block;cursor:pointer;width:20px;height:20px;margin-right:5px;line-height:20px;text-align:center;background:#fff; color:#f60;}
#img_box ol .active{background:#f60; color:#fff;padding:2px;bottom:2px;}
</style>
<script>
$(function(){
var iNow = 0;
var timer = null;
var $imgLi=$('#img_box ul li');
if($imgLi.length>0){
for(var i = 1; i <= $imgLi.length; i++){
var $olLi=$('<li>'+ i +'</li>');
$('#img_box ol').append($olLi);
}
$('#img_box ol li').eq(0).attr('class','active');
}; timer = setInterval(toRun,2000);
function toRun(){
if($imgLi.length>1){
if(iNow == $imgLi.length-1){
iNow = 0;
}
else{
iNow++;
}
$('#img_box ol li').attr('class','');
$('#img_box ol li').eq(iNow).attr('class','active');
$('ul').stop().animate({top : -150 * iNow},1000);
}
}
$('#img_box').mouseover(function(){
clearInterval(timer);
}).mouseout(function(){
timer=setInterval(toRun,2000);
});
$('#img_box ol li').click(function(ev){
//console.log($(this).html());
$('#img_box ol li').attr('class','');
$(this).attr('class','active');
iNow = $(this).html()-1;
$('ul').stop().animate({top : -150 * iNow},1000);
})
});
</script>
</head>
<body>
<div id="img_box">
<ul>
<li><img src="img/1.jpg" alt="" /></li>
<li><img src="img/2.jpg" alt="" /></li>
<li><img src="img/3.jpg" alt="" /></li>
<li><img src="img/4.jpg" alt="" /></li>
<li><img src="img/5.jpg" alt="" /></li>
<li><img src="img/3.jpg" alt="" /></li>
<li><img src="img/4.jpg" alt="" /></li>
<li><img src="img/5.jpg" alt="" /></li>
</ul>
<ol>
<!--<li class="active">1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>-->
</ol>
</div>
</body>
</html>

jq demo 轮播图,图片可调用,向上,自动+鼠标点击切换的更多相关文章

  1. jq demo 轮播图,图片可调用,向左,自动+鼠标点击切换

    <!doctype html> <html> <head> <meta http-equiv="Content-Type" content ...

  2. iview Carousel 轮播图自适应宽高;iview 轮播图 图片重叠问题;iview tabs 高度互相影响问题;vue this问题;

    最终效果图: 一.轮播图中图片自适应宽高:  <Carousel loop v-bind:height="imgHeight+'px'" v-model="caro ...

  3. JQ 实现轮播图(3D旋转图片轮播效果)

    轮播图效果如下: 代码: <!DOCTYPE html> <html xmlns="/www.w3.org/1999/xhtml"> <head> ...

  4. JQ万能轮播图

    lunbotu.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8">  ...

  5. 5 项目---自定义用户模型以及轮播图图片url返回格式

    创建自定义的用户模型类  1. 用命令创建users 应用 2. 将users 注册到settings.py INSTALLED_APPS = [ 'django.contrib.admin', 'd ...

  6. jq龙禧轮播图

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. JQ无缝轮播图-插件封装

    类似京东的这种无缝轮播效果: 实例代码下载 HTML代码: <body> <!-- /*觅me 探索生活*/ --> <div class="test" ...

  8. ionic3 slides轮播图手动滑动后无法自动播放问题

    我们都知道Ionic3为我们提供了一套丰富易用的UI组件库,然而凡事是都有不完美之处,今天我们来看一下ionic3 slides组件在实现轮播功能时候的小问题. 先开UI小姐姐给到的3张美美哒效果图 ...

  9. jq交叉轮播图变种【闪一下黑】

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

随机推荐

  1. Python记录10:模块

    ''' 1. 什么是模块     模块就一系列功能的集合体 模块有三种来源:         1. 内置的模块         2. 第三方的模块:pip install +模块名称         ...

  2. linq 表分组后关联查询

    测试linq,获取有教师名额的学校.比如学校有5个教师名额,teacher数量没超过5个,发现有空额 var query = (from teacher in _repositoryTeacher.T ...

  3. CentOS 7 yum安装zabbix 设置中文界面

    1.  配置安装前环境 2.  安装zabbix 3.  设置中文环境 准备搭建环境 : 系统:CentOS7.5 首先关闭SElinux 和防火墙 安装MariaDB数据库 [root@DaMoWa ...

  4. Sitecore中Core,Master和Web数据库之间的区别

    Core数据库 正如名称所示,Core Database是Sitecore应用程序的主干,它可用于多种用途. 核心数据库包含所有Sitecore设置. 它包含桌面模式,内容编辑器,页面编辑器等的定义. ...

  5. MSG结构体和WndProc窗口过程详解

    MSG结构体和WndProc窗口过程对于Windows编程非常重要,如果不了解它们,可以说就没有学会Windows编程. MSG结构体 MSG 结构体用来表示一条消息,各个字段的含义如下: typed ...

  6. C# 调用C++的dll 那些事

    之前从来没搞过C++,最近被安排的任务需要调用C++的接口,对于一个没用过 Dependency 的小白来说,原本以为像平时的Http接口那样,协议,端口一定义,方法参数一写就没事,结果踩了无数的坑. ...

  7. mysql日期操作

    一.获取当前日期时间 1.1.获得当前日期+时间(date+time)函数:now() 1.2.获取当前日期+时间(date+time)函数:sysdate() 注:二者类拟,不同在于now()在执行 ...

  8. 第九节 JS运动应用

    多物体运动框架 多个物体同时运动 例子:多个Div,鼠标移入变宽 单定时器,存在问题 每个Div一个定时器 <!DOCTYPE html> <html lang="en&q ...

  9. Docker run命令参数整理

    Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] -d, --detach=false 指定容器运行于前台还是后台,默认为false -i, - ...

  10. [c/c++] programming之路(22)、字符串(三)——字符串封装

    项目结构 头文件.h #include<stdio.h> #include<stdlib.h> #include<string.h> //字符串封装,需要库函数 / ...