bootstrap4-toggle
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -7,2 +7,11 @@ # Changelog | ||
## [3.2.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.2.0) 2018-11-27 | ||
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.1.0...v3.2.0) | ||
### Added | ||
### Changed | ||
- Removed permanent `active` state from "Off" label so mouse-over highlighting works the same as "On" | ||
### Removed | ||
## [3.1.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.1.0) 2018-10-25 | ||
@@ -15,2 +24,3 @@ ### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.0.0...v3.1.0) | ||
- Tweaked `border` property to work with all backgrounds and colors | ||
### Removed | ||
@@ -17,0 +27,0 @@ |
/*\ | ||
|*| ======================================================================== | ||
|*| Bootstrap Toggle: bootstrap4-toggle.js v3.1.0 | ||
|*| Bootstrap Toggle: bootstrap4-toggle.js v3.2.0 | ||
|*| https://gitbrent.github.io/bootstrap-toggle/ | ||
@@ -23,3 +23,3 @@ |*| ======================================================================== | ||
Toggle.VERSION = '3.0.0' | ||
Toggle.VERSION = '3.2.0' | ||
@@ -60,3 +60,3 @@ Toggle.DEFAULTS = { | ||
var $toggleOff = $('<label class="btn">').html(this.options.off) | ||
.addClass(this._offstyle + ' ' + size + ' active') | ||
.addClass(this._offstyle + ' ' + size) | ||
var $toggleHandle = $('<span class="toggle-handle btn btn-light">') | ||
@@ -63,0 +63,0 @@ .addClass(size) |
{ | ||
"name": "bootstrap4-toggle", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Brent Ely", |
118
README.md
@@ -1,2 +0,2 @@ | ||
[![Bootstrap 4.1.3](https://img.shields.io/badge/bootstrap-4.1.3-green.svg?style=flat-square)](https://getbootstrap.com/docs/4.1) [![MIT License](https://badges.frapsoft.com/os/mit/mit.svg?style=flat-square)](https://opensource.org/licenses/mit-license.php) | ||
[![Bootstrap 4.1.3](https://img.shields.io/badge/bootstrap-4.1.3-green.svg?style=flat-square)](https://getbootstrap.com/docs/4.1) [![MIT License](https://badges.frapsoft.com/os/mit/mit.svg?style=flat-square)](https://opensource.org/licenses/mit-license.php) [![Known Vulnerabilities](https://snyk.io/test/npm/bootstrap4-toggle/badge.svg)](https://snyk.io/test/npm/bootstrap4-toggle) | ||
@@ -9,14 +9,43 @@ # Bootstrap 4 Toggle | ||
## Installation | ||
************************************************************************************************** | ||
### Download | ||
[Version 3.1.0](https://github.com/gitbrent/bootstrap4-toggle/archive/v3.1.0.zip) is the latest version of Bootstrap4 Toggle. | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* | ||
### Use CDN | ||
- [Demos](#demos) | ||
- [Installation](#installation) | ||
- [Download](#download) | ||
- [CDN](#cdn) | ||
- [NPM](#npm) | ||
- [Yarn](#yarn) | ||
- [Usage](#usage) | ||
- [Initialize With HTML](#initialize-with-html) | ||
- [Initialize With Code](#initialize-with-code) | ||
- [API](#api) | ||
- [Options](#options) | ||
- [Methods](#methods) | ||
- [Events](#events) | ||
- [Event Propagation](#event-propagation) | ||
- [API vs Input](#api-vs-input) | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
************************************************************************************************** | ||
# Demos | ||
Visit https://gitbrent.github.io/bootstrap4-toggle/ for interactive checkbox toggle demos. | ||
# Installation | ||
## Download | ||
[Version 3.2.0](https://github.com/gitbrent/bootstrap4-toggle/archive/v3.2.0.zip) is the latest version of Bootstrap4 Toggle. | ||
## CDN | ||
```html | ||
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.1.0/css/bootstrap4-toggle.min.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.1.0/js/bootstrap4-toggle.min.js"></script> | ||
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.2.0/css/bootstrap4-toggle.min.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.2.0/js/bootstrap4-toggle.min.js"></script> | ||
``` | ||
### Node.js | ||
## NPM | ||
```bash | ||
@@ -26,11 +55,11 @@ npm install bootstrap4-toggle | ||
### Yarn | ||
## Yarn | ||
```bash | ||
yarn install | ||
yarn install bootstrap4-toggle | ||
``` | ||
## Usage | ||
# Usage | ||
### Basic example | ||
Simply add `data-toggle="toggle"` to automatically convert checkboxes into toggles. | ||
## Initialize With HTML | ||
Simply add `data-toggle="toggle"` to automatically convert a plain checkbox into a bootstrap 4 toggle. | ||
@@ -41,50 +70,18 @@ ```html | ||
### Stacked checkboxes | ||
Refer to Bootstrap Form Controls documentation to create stacked checkboxes. Simply add `data-toggle="toggle"` to convert checkboxes into toggles. | ||
## Initialize With Code | ||
Toggles can also be initialized via JavaScript code. | ||
EX: Initialize id `chkToggle` with a single line of JavaScript. | ||
```html | ||
<div class="form-check form-check"> | ||
<label> | ||
<input type="checkbox" data-toggle="toggle"> | ||
Option one is enabled | ||
</label> | ||
</div> | ||
<div class="form-check form-check disabled"> | ||
<label> | ||
<input type="checkbox" disabled data-toggle="toggle"> | ||
Option two is disabled | ||
</label> | ||
</div> | ||
``` | ||
### Inline Checkboxes | ||
Refer to Bootstrap Form Controls documentation to create inline checkboxes. Simply add `data-toggle="toggle"` to a convert checkboxes into toggles. | ||
```html | ||
<label class="form-check form-check-inline"> | ||
<input type="checkbox" checked data-toggle="toggle"> First | ||
</label> | ||
<label class="form-check form-check-inline"> | ||
<input type="checkbox" data-toggle="toggle"> Second | ||
</label> | ||
<label class="form-check form-check-inline"> | ||
<input type="checkbox" data-toggle="toggle"> Third | ||
</label> | ||
``` | ||
## API | ||
### Initialize by JavaScript | ||
Initialize toggles with id `toggle-one` with a single line of JavaScript. | ||
```html | ||
<input id="toggle-one" checked type="checkbox"> | ||
<input id="chkToggle" type="checkbox" checked> | ||
<script> | ||
$(function() { | ||
$('#toggle-one').bootstrapToggle(); | ||
}) | ||
$(function(){ | ||
$('#chkToggle').bootstrapToggle(); | ||
}); | ||
</script> | ||
``` | ||
### Options | ||
# API | ||
## Options | ||
* Options can be passed via data attributes or JavaScript | ||
@@ -117,3 +114,3 @@ * For data attributes, append the option name to `data-` (ex: `data-on="Enabled"`) | ||
### Methods | ||
## Methods | ||
Methods can be used to control toggles directly. | ||
@@ -135,5 +132,5 @@ | ||
## Events | ||
# Events | ||
### Event Propagation | ||
## Event Propagation | ||
Note All events are propagated to and from input element to the toggle. | ||
@@ -155,3 +152,3 @@ | ||
### API vs Input | ||
## API vs Input | ||
This also means that using the API or Input to trigger events will work both ways. | ||
@@ -180,4 +177,1 @@ | ||
``` | ||
## Demos | ||
Visit https://gitbrent.github.io/bootstrap4-toggle/ for demos. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17656
242
171