技术标签: demo
JQuery库中的插件来写轮播图,虽然其库用起来甚是方便,简介 ,提高了工作 效率。下边我就为大家提供一种JQuery的轮播图:
index.html 文件结构如下:
//一定要先引入js文件、css文件
<div class="con_wrap">
<div class="tit_wrap">
<h1>JS原生轮播图</h1>
<div class="box">
<ul id="ul">
<li><img src="images/1.jpg" alt=""></li>
<li><img src="images/2.jpg" alt=""></li>
<li><img src="images/3.jpg" alt=""></li>
<li><img src="images/4.jpg" alt=""></li>
</ul>
<div class="box-arrow">
<span id="arr-left"><</span>
<span id="arr-right">></span>
</div>
<ul class="box-circle"></ul>
</div>
</div>
style.css 文件如下:
body {
/*初始化样式*/
margin: 0;
padding: 0;
}
.box {
/*给盒子定义样式*/
width: 1100px;
height: 400px;
overflow: hidden;
position: relative;//相对定位
}
.box ul {
list-style: none;
padding: 0;
margin: 0;
position: absolute;
}
.box li {
float: left;
width: 1100px;
height: 400px;
}
.box ul img {
width: 100%;
height: 100%;
display: block;
}
.box-arrow {
position: absolute;//绝对定位
left: 0;
top: 50%;
margin-top: -35px;
width: 100%;
display: none;
}
.box-arrow span {
color: white;
font-size: 40px;
cursor: pointer;
display: block;
background-color: black;
width: 30px;
text-align: center;
/*禁用用户选中文本*/
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
}
#arr-left {
float: left;
}
#arr-right {
float: right;
}
.box-circle {
position: absolute;
bottom: 20px;
left: 50%;
}
.box-circle li {
width: 20px;
height: 20px;
text-align: center;
position: relative;
left: -50%;
background-color: black;
cursor: pointer;
color: white;
font-size: 12px;
line-height: 15px;
font-family: 'Microsoft YaHei';
margin-right: 10px;
border-radius: 11px;
}
.box-circle li.hover {
background-color: orangered;
}
index.js
$(function(){
//切换显示箭头
$('.box').on('mouseover',function(){
//鼠标覆盖时,显示箭头,关闭自动轮播
clearInterval(timer);
$('.box-arrow').show();
}).on('mouseleave',function(){
//鼠标离开时,隐藏箭头,开启自动轮播
$('.box-arrow').hide();
autoPlay();
});
//目标索引值
var targetIndex = 0;
//定时器句柄
var timer=null;
//是否执行轮播的标识
var flag = true;
//轮播时,操作位置的元素
var ul = $('#ul');
//每个图片的宽度
var width = 0 - $('.box li:eq(0)').width();
//复制第一个li元素,append到最后
$('#ul').append($('#ul li:eq(0)').clone()).width(Math.abs(width)*$('#ul>li').length);
var count = $('#ul>li').length;
//轮播图片的方法
function play(){
if(flag){
//标识为true时,执行轮播
flag=false;//执行轮播前,将标识符设为false
//计算小圆点索引
var circleIndex = targetIndex;
if(targetIndex>(count-2)){
circleIndex = 0;
}
if(targetIndex<0){
circleIndex = count-2;
}
//根据索引,修改小圆点样式
$('.box-circle li:eq('+circleIndex+')').addClass('hover')
.siblings().removeClass('hover');
//使用animate方法轮播图片
$(ul).animate({
'left':targetIndex*width+'px'},500,function(){
flag=true;//执行轮播完毕后,将标识符设为true
});
}
}
//点击向右移动
$('#arr-right').on('click',function(){
if(!flag){
//当标识符为false时,禁止更改目标索引值和执行轮播动画
return;
}
if(targetIndex+1 > count-1){
targetIndex = 1;
$(ul).css('left','0px');
}else{
targetIndex++;
}
play();
});
//点击向左移动
$('#arr-left').on('click',function(){
if(!flag){
//当标识符为false时,禁止更改目标索引值和执行轮播动画
return;
}
if(targetIndex-1 < 0){
targetIndex = count-2;
$(ul).css('left',(targetIndex+1)*width+'px');
}else{
targetIndex--;
}
play();
});
//自动轮播的方法
function autoPlay(){
timer = setInterval(function(){
$('#arr-right').trigger('click');
},2000);
}
//执行自动轮播
autoPlay();
//循环创建小圆点
for(var i=0; i<count-1; i++){
//因为count包含克隆的元素,所以需要count-1
var hoverClass = '';
if(i==0){
hoverClass = 'hover';
}
$('.box-circle').append('<li class="'+hoverClass+'">'+(i+1)+'</li>');//向页面添加小圆点
}
//小圆点的鼠标覆盖事件
$('.box-circle li').on('mouseover',function(){
$(this).addClass('hover').siblings().removeClass('hover');//切换样式
//索引检测,当索引在最后一张克隆图片上、覆盖到第一个小圆点的时候,直接切换回第一张
if($(this).index()==0&&targetIndex==(count-1)){
ul.css('left','0px');
}
targetIndex = $(this).index();//修改目标索引为当前鼠标覆盖小圆点的索引值
//轮播图片
play();
});
});
本篇文章的内容只是我个人经验总结;分享出来,希望可以帮都大家。
Buuctf misc 秘密文件binwalk 305df1f78bef4ccfd2a3bd0fe4a6c0d7.pcapng发现有rar文件更改文件后缀名,发现有密码用ARCHPR进行暴力破解
先来理解一下什么是phpddos流量攻击,phpddos是一种黑客经过入侵WEB效劳器植入phpshell从而控制这个phpshell 向其他受害者或本人的效劳器发送UDP攻击包停止DDOS攻击,这类攻击有一个最大的特性,就是上传流量霎时增大,通常流量高达数十以至近百M,将整台效 劳器,以至将整台机柜的宽带堵住,使网站无法运转,而这样的攻击,我们无法从远程处理,一但那个phpshell运转,你的宽
前言相关解析及参考:超详细解读ORB-SLAM3单目初始化(下篇)ORB_SLAM3和之前版本有什么不同?_小白学视觉的技术博客_51CTO博客orbslam3 官方源码地址:https://github.com/UZ-SLAMLab/ORB_SLAM3️ 注意如果是ROS编译请见issue:https://github.com/UZ-SLAMLab/ORB_SLAM3/issues/442 或直接使用fork版本下的 https://gitee.com/Kin-Zhang/ORB_SL
点击打开链接X is a fully prosperous country, especially known for its complicated transportation networks. But recently, for the sake of better controlling by the government, the president Fat Bro
通过内置的函数(例如 len、iter、str,等等)来使用特殊方法是最好的选择。这些内置函数不仅会调用特殊方法,通常还提供额外的好处,而且对于内置的类来说,它们的速度更快Python 有一个内置的函数叫 repr,它能把一个对象用字符串的形式表达出来以便辨认,这就是“字符串表示形式”。repr 就是通过 __repr__这个特殊方法来得到一个对象的字符串表示形式的生成器表达式的语法跟列表推导差不...
最近看了几篇关于视网膜层切割的处理论文,现在比较流行的方法是用FCN(全卷积神经网络来做)。在医疗领域中,通常使用一种称之为U-net的FCN来做图像切割,效果不错。 本文基于U-net来做实现,详细介绍了如何搭建一个U-net神经网络。全卷积神经网络关于FCN的介绍详见我的FCN全卷积网络的博客,这里不再赘述啦。医学图像分割框架现在的医学图像分割(尤其是眼科OCT图像(光学相关层析图像
题目地址http://poj.org/problem?id=3259WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 37361 Accepted: 13736DescriptionWhile exploring his
上一篇文章中我们为大家介绍了嵌入式设备中支持国密算法的几种方法。本篇我们详细的介绍一下第一种方法:移植Miracl库的具体操作步骤。第一步 获取源码MIRACL密码库是开源软件,可以直接到官网下载,也可在csdn等论坛中获取。第二步利用MIRACL库函数实现SM2算法实现sm2的功能需要用到MIRACL库中的36个源文件,例如mraes.c、mrec2.c、mrarth0...
import hmacimport hashlibdef jm_sha256(key, value): """ sha256加密 return:加密结果转成16进制字符串形式 """ hsobj = hashlib.sha256(key.encode("utf-8")) hsobj.update(value.encode("utf-8"))...
Today, I found the cpu of load of my server is too high,and the server is just running a Java application.Here are my operation steps.I used top command to find the application's pid. The pid is 25713...
1. 在淘宝直播间按F12打开开发者页面,然后输入.m3u8作为筛选条件2. 复制m3u8链接3. 点击添加4. 点击全部开始下载的结果就在output文件里
Android测试中,经常需要kill掉应用程序。 网上有用方法:adb shell中的kill命令后面跟的参数是pid,因此先ps所有的应用程序。缺点是,PS显示很长,找到你的应用比较麻烦。 另一种方法是使用包名,比较简单: C:\Android\adt-bundle-windows-x86-20130729\sdk\platform-tools>adb shell am