jQuery分步步骤
插件描述:jQuery上一步、下一步,分步步骤,兼容性如下:

使用方法
1.引入样式和脚本
<link rel="stylesheet" type="text/css" href="css/jquery.step.css" />
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script src="js/jquery.step.min.js"></script>
2.初始化插件
var $step = $("#step");
$step.step({
index: 0,
time: 500,
title: ["填写申请表", "上传资料", "待确认", "已确认", "预约完成"]
});
3.方法
$step.getIndex();// 获取当前的index
$step.prevStep();// 上一步
$step.nextStep();// 下一步
$step.toStep(index);// 跳到指定步骤
插件css源码:
body,
div,
ul,
li {
margin:;
padding:;
} body {
font-family: "微软雅黑";
} .ui-step-wrap {
position: relative;
} .ui-step-wrap .ui-step-bg,
.ui-step-wrap .ui-step-progress {
height: 6px;
position: absolute;
top: 50px;
left:;
} .ui-step-wrap .ui-step-bg {
width: 100%;
background: #ddd;
} .ui-step-wrap .ui-step-progress {
width:;
background: #64BD2E;
} .ui-step-wrap .ui-step {
position: relative;
z-index:;
list-style: none;
} .ui-step-wrap .ui-step:after {
content: '';
display: table;
clear: both;
} .ui-step-wrap .ui-step .ui-step-item {
float: left;
} .ui-step-wrap .ui-step .ui-step-item div {
text-align: center;
color: #625454;
} .ui-step-wrap .ui-step .ui-step-item .ui-step-item-num {
margin-top: 18px;
} .ui-step-wrap .ui-step .ui-step-item .ui-step-item-num span {
display: inline-block;
width: 26px;
height: 26px;
border-radius: 50%;
background: #dad9d9;
} .ui-step-wrap .ui-step .ui-step-item.active .ui-step-item-num span {
color: #fff;
background: #64BD2E;
}
插件压缩源码:
!function(i){i.fn.step=function(e){var t=this,n={index:0,time:400,title:[]},s=(e=i.extend({},n,e)).title,d=s.length,u=e.time,p=t.width()/d;t.index=e.index;var a=function(){var e="";s.length>0&&(e+='<div class="ui-step-wrap"><div class="ui-step-bg"></div><div class="ui-step-progress"></div><ul class="ui-step">',i.each(s,function(i,t){e+='<li class="ui-step-item"><div class="ui-step-item-title">'+t+'</div><div class="ui-step-item-num"><span>'+(i+1)+"</span></div></li>"}),e+="</ul></div>"),t.append(e),t.find(".ui-step").children(".ui-step-item").width(p),t.toStep(t.index)};return t.toStep=function(e){var n=t.find(".ui-step").children(".ui-step-item");t.index=e,t.find(".ui-step-progress").animate({width:p*(e+1)},u,function(){i.each(n,function(t){t>e?i(this).removeClass("active"):i(this).addClass("active")})})},t.getIndex=function(){return t.index},t.nextStep=function(){t.index>d-2||(t.index++,t.toStep(t.index))},t.prevStep=function(){t.index<1||(t.index--,t.toStep(t.index))},a(),this}}(jQuery);
插件实例:
<!DOCTYPE html>
<html> <head>
<meta charset="utf-8" />
<title>jQuery分步步骤</title>
<link rel="stylesheet" type="text/css" href="css/jquery.step.css" />
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script src="js/jquery.step.min.js"></script>
<style>
button {
display: inline-block;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
text-align: center;
cursor: pointer;
border: 1px solid transparent;
border-radius: 4px;
color: #fff;
background-color: #5bc0de;
} .main {
width: 1000px;
margin: 100px auto;
} #step {
margin-bottom: 60px;
} .btns {
float: left;
} .info {
float: left;
height: 34px;
line-height: 34px;
margin-left: 40px;
font-size: 28px;
font-weight: bold;
color: #928787;
} .info span {
color: red;
}
</style>
</head> <body>
<div class="main">
<div id="step"></div>
<div class="btns">
<button id="prevBtn">上一步</button>
<button id="nextBtn">下一步</button>
<button id="btn1">跳到第二步</button>
<button id="btn2">跳到第三步</button>
</div>
<div class="info">index:<span id="index"></span></div>
</div> <script type="text/javascript">
var $step = $("#step");
var $index = $("#index"); $step.step({
index: 0,
time: 500,
title: ["填写申请表", "上传资料", "待确认", "已确认", "预约完成"]
}); $index.text($step.getIndex()); $("#prevBtn").on("click", function() {
$step.prevStep();
$index.text($step.getIndex());
}); $("#nextBtn").on("click", function() {
$step.nextStep();
$index.text($step.getIndex());
}); $("#btn1").on("click", function() {
$step.toStep(1);
$index.text($step.getIndex());
}); $("#btn2").on("click", function() {
$step.toStep(2);
$index.text($step.getIndex());
});
</script>
</body> </html>
原文地址:http://www.jq22.com/jquery-info15145
jQuery分步步骤的更多相关文章
- 在进行vue的学习,项目中需要引入bootstrap、jquery的步骤。
在进行vue的学习,项目中需要引入bootstrap.jquery的步骤. 一.引入jQuery 在当前项目的目录下(就是package.json),运行命令 cnpm install jquery ...
- 11 个超棒的 jQuery 分步指引插件
当一个网站或者一个Web应用推出新功能时,为了让用户了解你的站点(或应用)如何操作,往往都会在站点(应用)中添加一个分步指引的效果.然而这样的效果,对于不懂原生JS的同学来说,是件很头痛的事情. 下面 ...
- 11个超棒的 jQuery 分步指引插件(转)
当一个网站或者一个Web应用推出新功能时,为了让用户了解你的站点(或应用)如何操作,往往都会在站点(应用)中添加一个分步指引的效果.然而这样的效果,对于不懂原生JS的同学来说,是件很头痛的事情. 下面 ...
- jQuery 分步引导 插件
转自:http://blog.libnav.com/js/57.html 很多时候一个网站或者一个Web应用出品,为了让你的用户知道你的站点(或应用)有些什么?如何操作?为了让你的用户有更好的体验.往 ...
- 推荐15款最佳的 jQuery 分步引导插件
当用户浏览到一个网站,它可能从不知道如何浏览,如何操作网站或 Web 应用程序的内容和流程.在这篇文章中,我们编制了一些最好的 jQuery 引导插件列表.你会发现这些插件对于提高你的网站的整体用户体 ...
- Jquery分步学习一
<script type="text/javascript" src="../js/jquery-1.11.0.js"></script> ...
- jQuery UI Datepicker使用介绍
本博客使用Markdown编辑器编写 在企业级web开发过程中,日历控件和图表控件是使用最多的2中第三方组件.jQuery UI带的Datepicker,日历控件能满足大多数场景开发需要.本文就主要讨 ...
- 22、JSON/jQuery上
1)掌握JSON及其应用 2)了解jQuery的背景和特点 3)理解js对象和jQuery对象的区别 4)掌握jQuery九类选择器及应用(上) 声明:今天服务端我们使用Struts2技术 一 ...
- jQuery初步
1.jQuery开发步骤 jQuery是第三方开源组织基于js写的一款跨主流浏览器的实用库. (1)引用第三方js库文件,<script type="text/javascript&q ...
随机推荐
- Iterables vs. Iterators vs. Generators
Reprinted from: Iterables vs. Iterators vs. Generators Occasionally I've run into situations of conf ...
- async_retrying
from async_retrying import retry import aiohttp import asyncio @retry(attempts=6) async def fetch(): ...
- [转]POI大数据量Excel解决方案
全文转载自:jinshuaiwang的博客 目前处理Excel的开源javaAPI主要有两种,一是Jxl(Java Excel API),Jxl只支持Excel2003以下的版本.另外一种是Apach ...
- 漏洞扫描工具Nessu的安装和简单使用
一.软件介绍Nessus号称是世界上最流行的漏洞扫描程序,全世界有超过75000个组织在使用它.该工具提供完整的电脑漏洞扫描服务,并随时更新其漏洞数据库.Nessus不同于传统的漏洞扫描软件,Ness ...
- datepicker 属性设置 以及方法和事件
DatePicker支持鼠标点选日期,同时还可以通过键盘控制选择: page up/down - 上一月.下一月 ctrl+page up/down - 上一年.下一年 ctrl+home - 当前月 ...
- Keil和SourceInsight中文乱码解决方法
一.KEIL乱码 到菜单栏Edit--->Configuration-->Encoding ---ChineseSimplied 二.SourceInsight乱码 错误现象:注释乱码,查 ...
- linux 查看nginx如何启动
执行命令: ps -A | grep nginx如果返回结果的话,说明有nginx在运行,服务已经启动
- 洛谷P4630 [APIO2018]铁人两项 [广义圆方树]
传送门 又学会了一个新东西好开心呢~ 思路 显然,假如枚举了起始点\(x\)和终止点\(y\),中转点就必须在它们之间的简单路径上. 不知为何想到了圆方树,可以发现,如果把方点的权值记为双联通分量的大 ...
- 安卓易学,爬坑不易—腾讯老司机的RecyclerView局部刷新爬坑之路
前言 安卓开发者都知道,RecyclerView比ListView要灵活的多,但不可否认的里面的坑也同样埋了不少人.下面让我们看看腾讯开发工程师用实例讲解自己踩坑时的解决方案和心路历程. 话说有图有真 ...
- SQL Server 数据恢复到指点时间点(完整恢复)
SQL Server 数据恢复到指点时间点(完整恢复) 高文龙关注2人评论944人阅读2017-03-20 12:57:12 SQL Server 数据恢复到指点时间点(完整恢复) 说到数据库恢复,其 ...