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. (Review cs231n) BN and Activation Function

    CNN网络的迁移学习(transfer learning) 1.在ImageNet上进行网络的预训练 2.将最上方的层,即分类器移除,然后将整个神经网络看成是固定特征提取器来训练,将这个特征提取器置于 ...

  2. Appium+python自动化1-环境搭建(上)

    前言 appium可以说是做app最火的一个自动化框架,它的主要优势是支持android和ios,另外脚本语言也是支持java和Python.小编擅长Python,所以接下来的教程是appium+py ...

  3. JS中几种常见的高阶函数

    高阶函数:英文叫Higher-order function.JavaScript的函数其实都指向某个变量.既然变量可以指向函数,函数的参数能接收变量,那么一个函数就可以接收另一个函数作为参数,这种函数 ...

  4. Python关键点笔记之使用 pyenv 管理多个 Python 版本依赖环境

    0x00 背景 从接触Python以来,一直都是采用virtualenv和virtualenvwrapper来管理不同项目的依赖环境,通过workon.mkvirtualenv等命令进行虚拟环境切换, ...

  5. K8S学习笔记之ETCD启动失败注意事项

    最近搭建K8S集群遇到ETCD的报错,报错信息如下,一定要关闭防火墙.iptables和SELINUX,三个都要关闭!! Mar 26 20:39:24 k8s-m1 etcd[6437]: heal ...

  6. FIT9132 Introduction to Databases

    FIT9132 Introduction to Databases2019 Semester 1Assignment 1 - Database Design - Monash Hospital (MH ...

  7. 剑指offer(29)最小的K个数

    题目描述 输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,. 题目分析 这题有两种方法来做. 第一种就是基于partition的 ...

  8. js前端文件收集(一)

    1.保存cookies的文件: /** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual license ...

  9. Python3 tkinter基础 Menu 添加菜单栏

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  10. luogu[愚人节题目3]现代妖怪殖民地 NTT

    U34272 [愚人节题目3]现代妖怪殖民地 fft 题目链接 https://www.luogu.org/problemnew/show/U34272 思路 虽然是个py题. ntt(或者fft)模 ...