Skip to content

Commit c309a5d

Browse files
committed
use data-{option_key} syntax instead of rcswitcher-{option_key} attributes.
1 parent b8682e1 commit c309a5d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* ability to automatic stick switch to its parent side.
4444
* show switch corresponding input for functionality testing.
4545
* fire custom events on turnon, turnoff and change. so you can perform your tasks depends on switch status.
46-
* >on firing events an information plain object is passed to event handler function as the second argument. it contains jquery objects of each switch piece and also input jquery object
46+
* on firing events an information plain object is passed to event handler function as the second argument. it contains jquery objects of each switch piece and also input jquery object
4747

4848

4949
---
@@ -110,13 +110,13 @@ $(':radio').rcSwitcher().on({
110110

111111
__Options that could be set inside html input as attributes__
112112

113-
>_`rcswitcher-ontext=""`_
114-
>_`rcswitcher-offtext=""`_
113+
>_`data-ontext=""`_
114+
>_`data-offtext=""`_
115115
>>those attributes are equivalent to onText, offText options
116116
>>__*but they have more priority and if set they will override options values*__
117117
118118
```html
119119
<!-- Set OnText and offText inside input element itself -->
120-
<input type="checkbox" name="" value="" rcswitcher-ontext="YES" rcswitcher-offtext="NO" />
120+
<input type="checkbox" name="" value="" data-ontext="YES" data-offtext="NO" />
121121

122122
```

js/rcswitcher.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106

107107
data.components.$toggler = templates.$toggler.clone();
108108

109-
data.components.$on = templates.$on.clone().html( $input.attr('rcswitcher-ontext') || options.onText );
110-
data.components.$off = templates.$off.clone().html( $input.attr('rcswitcher-offtext') || options.offText );
109+
data.components.$on = templates.$on.clone().html( $input.attr('data-ontext') || options.onText );
110+
data.components.$off = templates.$off.clone().html( $input.attr('data-offtext') || options.offText );
111111
data.components.$blob = templates.$blob.clone();
112112

113113

@@ -399,7 +399,7 @@
399399

400400
// Fire Event and pass data object to event handler
401401
data.$input.trigger( 'turnoff.rcSwitcher', data );
402-
data.$input.trigger( 'change.rcSwitcher', data );
402+
data.$input.trigger( 'change.rcSwitcher', data, 'turnoff' );
403403

404404

405405

@@ -429,7 +429,7 @@
429429

430430
// Fire Event and pass data object to event handler
431431
data.$input.trigger( 'turnon.rcSwitcher', data );
432-
data.$input.trigger( 'change.rcSwitcher', data );
432+
data.$input.trigger( 'change.rcSwitcher', data, 'turnon' );
433433

434434

435435
},

js/rcswitcher.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)