No. it's not the nintendo switch
Suppose you wanna have two blocks appear when the other disappears, this boi is for you
<div class="switch" id="switch-boi">
<div class="switch-off">
<h1>Title</h1>
<button class="btn btn-link" data-toggle-switch-on href="#switch-boi">
Click to edit me
</button>
</div>
<div class="switch-on">
<div class="input-group input-large input-block input-group-horizontal">
<input type="text" class="input input-single-line" />
<button data-toggle-switch-off href="#switch-boi" class="btn btn-primary">
Save
</button>
</div>
</div>
</div>Wrapper of the blocks that will toggle each other. By default, javascript will set this to off with the class switch-to-off. If you want this to default to on by default, add switch-to-on to the block. if it doesn't work, Sam's programming is shit and feel free to tell her so.
If yopu dont want it to automatically off itself when ckiclity clack awei, add class switch-idle
If you want it top be on its on state on initial page load,, add class switch-to-on
The block to show when the switch is "on"
The block to show when the switch is "off"
Toggle to enable the on state of a switch. will look for the matching href, data-href, or closest .switch ancestor to toggle
Toggle to enable the off state of a switch. will look for the matching href, data-href, or closest .switch ancestor to toggle
If u want this toggle to be the all powerful god that can do both
Make a new boi by going const switchElement = new fw.Switch(element)
element is the switchElement itself. if blank, does nothing
turns off the switch as initial state, unless it was deliberately turned on in the first place
element is the element triggered. if left blank, this defaults to the element attached to the instance
duh
element is the element triggered. if left blank, this defaults to the element attached to the instance
duh
element is the element triggered. if left blank, this defaults to the element attached to the instance
duh
element is the element triggered. if left blank, this defaults to the element attached to the instance
turns off all switches
exemptedSwitchElement is DOMElement of dropdown to exempt from the purge
returns obj with component arg defaults
initializes all event listeners
returns obj with component set args
click_fw_switch- happens ontriggererclick_fw_switch_purge- happens on elements that qualify closing switchElement componentsbefore_init_fw_switch- happens ondocumentbefore running functions to set upinit_fw_switch- happens ondocumentwhen running functions to set upafter_init_fw_switch- happens ondocumentafter running functions to set upbefore_on_fw_switch- happens onelementbefore turning it onon_fw_switch- happens onelementwhen turning it onafter_on_fw_switch- happens onelementafter turning it onbefore_off_fw_switch- happens onelementbefore turning it offoff_fw_switch- happens onelementwhen turning it offafter_off_fw_switch- happens onelementafter turning it off