当前位置: 首页 > 软件库 > Web应用开发 > CSS框架 >

bs-stepper

A stepper for Bootstrap 4.x
授权协议 MIT License
开发语言 HTML/CSS
所属分类 Web应用开发、 CSS框架
软件类型 开源软件
地区 不详
投 递 者 乐正洲
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

bs-stepper

Build Status

A stepper plugin for Bootstrap 4.

You can use it on React and Angular too because this plugin is written with the most used JavaScript framework: VanillaJS.

Demo

If you want to see our latest changes check out https://bs-stepper.netlify.com/

Features:

  • Linear stepper
  • Non linear stepper
  • Fade effect with .fade
  • Vertical stepper
  • Works with Bootstrap 4
  • Accessible
  • Works without dependencies (so no jQuery needed)
  • Built in UMD so it can be used everywhere
  • Small, only 2kb

Table of contents

Install

With npm or yarn

# npm
npm install bs-stepper --save

# yarn
yarn add bs-stepper

CDN

CDN Link
jsDelivr, js minified https://cdn.jsdelivr.net/npm/bs-stepper/dist/js/bs-stepper.min.js
jsDelivr, css minified https://cdn.jsdelivr.net/npm/bs-stepper/dist/css/bs-stepper.min.css

How to use it

HTML markup

Include the CSS file:

<link rel="stylesheet" href="bs-stepper.min.css">

Add the following HTML:

<div class="bs-stepper">
  <div class="bs-stepper-header" role="tablist">
    <!-- your steps here -->
    <div class="step" data-target="#logins-part">
      <button type="button" class="step-trigger" role="tab" aria-controls="logins-part" id="logins-part-trigger">
        <span class="bs-stepper-circle">1</span>
        <span class="bs-stepper-label">Logins</span>
      </button>
    </div>
    <div class="line"></div>
    <div class="step" data-target="#information-part">
      <button type="button" class="step-trigger" role="tab" aria-controls="information-part" id="information-part-trigger">
        <span class="bs-stepper-circle">2</span>
        <span class="bs-stepper-label">Various information</span>
      </button>
    </div>
  </div>
  <div class="bs-stepper-content">
    <!-- your steps content here -->
    <div id="logins-part" class="content" role="tabpanel" aria-labelledby="logins-part-trigger"></div>
    <div id="information-part" class="content" role="tabpanel" aria-labelledby="information-part-trigger"></div>
  </div>
</div>
  • If you want to use the fade animation, add the .fade class on your .content and set animation to true.
  • To create a vertical stepper, just add the .vertical class on your stepper. All steppers will switch to vertical on small viewports.

JavaScript

Include the script before the end of the <body> HTML tag:

<script src="bs-stepper.min.js"></script>

Or with npm

import Stepper from 'bs-stepper'

Create a stepper

You should wait for the document ready event and create a new instance of Stepper.

Vanilla JS

document.addEventListener('DOMContentLoaded', function () {
  var stepper = new Stepper(document.querySelector('.bs-stepper'))
})

With jQuery

$(document).ready(function () {
  var stepper = new Stepper($('.bs-stepper')[0])
})

For more examples check out this file.

This library is UMD-ready so you can use it everywhere.

Methods

constructor

Create an instance of Stepper, accepts two parameters.

Parameters

  • element
  • type: DOMElement

Pass your Stepper DOMElement

  • options (optional)

    • type: Object

    default value:

    {
      linear: true,
      animation: false,
      selectors: {
        steps: '.step',
        trigger: '.step-trigger',
        stepper: '.bs-stepper'
      }
    }

    Allows you to customize the stepper selectors and its behavior.

next

Will navigate to the next step of your stepper. This method also emits the show.bs-stepperevent before showing the step and the shown.bs-stepper even when the step is displayed.

var stepper = new Stepper(document.querySelector('.bs-stepper'))
stepper.next()

previous

Will navigate to the previous step of your stepper. This method also emits the show.bs-stepperevent before showing the step and the shown.bs-stepper event when the step is displayed.

to

Will navigate to a step of your stepper. This method also emits the show.bs-stepper eventbefore showing the step and the shown.bs-stepper event when the step is displayed.

var stepper = new Stepper(document.querySelector('.bs-stepper'))

/// Will navigate to the second step
stepper.to(2)

reset

Will reset your stepper to the first step (useful for linear stepper). This method also emitsthe show.bs-stepper before showing the step and the shown.bs-stepper event when the step is displayed.

destroy

Remove stored data related to your stepper and listeners.

Events

The methods which triggers a step change trigger two events:

  • show.bs-stepper
  • shown.bs-stepper

You can listen on those events like this:

var stepperEl = document.getElementById('stepper')
var stepper = new Stepper(stepperEl)

stepperEl.addEventListener('show.bs-stepper', function (event) {
  // You can call preventDefault to stop the rendering of your step
  // event.preventDefault()

  console.warn(event.detail.indexStep)
})

stepperEl.addEventListener('shown.bs-stepper', function (event) {
  console.warn('step shown')
})

The event detail object contains the following properties:

{
  indexStep: contains the id of the step which will be displayed,
  to: alias of indexStep,
  from: previous step id (or current step id)
}

If you need to prevent the display of a step, you have to call preventDefault on the show.bs-stepper listener.

Compatibility

bsStepper is compatible with:

  • IE10+
  • Edge
  • Firefox
  • Chrome
  • Safari
  • Chrome Android
  • Safari iOS

You can find our BrowserStack list of browsers here.

Support me

If you want to thank me or support my work:

Thanks

BrowserStack Logo

Thanks to BrowserStack for providing the infrastructure that allows us to test in real browsers!

License

MIT

 相关资料
  • bs :: framework 是一个新一代 C ++ 游戏开发框架,专注于现代技术、高质量设计和高性能,旨在为开发实时图形应用程序(游戏、引擎或工具)提供统一的基础。 bs :: framework 提供了从音频、动画、GUI、输入、物理、渲染到脚本系统等图形应用开发所需的一切。它还内置了对30多种图像、mesh 和音频格式的支持,以及应用广泛的数学库、RTTI(run-time type in

  • BS Redis Desktop Client是一个基于Rust和Sciter的Redis桌面工具。 为什么有这个工具 太多的工具基于electron,太大太重。 rdm 对于我来说不符合审美。 基于rust和sciter的编写的桌面工具又快又轻。 基于html的sciter让我可以轻松创建一个漂亮的GUI界面。 界面预览 主界面  添加新连接界面  key 列表 

  • Corporate Bullshit/Buzzword Generator API Corporate bullshit is the icing on the cake, proof that not even the business world takes the business world seriously. People get annoyed about it but don’t

  • 本文向大家介绍请说明 BS与CS 的联系,还有区别。相关面试题,主要包含被问及请说明 BS与CS 的联系,还有区别。时的应答技巧和注意事项,需要的朋友参考一下 考察点:客户端/服务器模式   C/S是Client/Server的缩写。服务器通常采用高性能的PC、工作站或小型机,并采用大型数据库系统,如Oracle、Sybase、Informix或 SQL Server。客户端需要安装专用的客户端软

  • 本文向大家介绍bs架构和cs架构的区别_动力节点Java学院整理,包括了bs架构和cs架构的区别_动力节点Java学院整理的使用技巧和注意事项,需要的朋友参考一下 1、CS、BS架构定义 CS(Client/Server):客户端----服务器结构。C/S结构在技术上很成熟,它的主要特点是交互性强、具有安全的存取模式、网络通信量低、响应速度快、利于处理大量数据。因为客户端要负责绝大多数的业务逻辑和

  • 我试图在这个网站上搜索web数据,我能够访问数据的唯一方法是遍历表的行,将它们添加到列表中(然后将它们添加到pandas数据框架中/写入csv),然后单击下一页并重复这个过程[每次搜索大约有50页,我的程序进行100+次搜索]。它非常慢/效率低,我想知道是否有一种方法可以使用pandas或Beautive soup高效地添加所有数据,而不是遍历每一行/每列。