Skip to content

Instantly share code, notes, and snippets.

View haleyngonadi's full-sized avatar

haley. haleyngonadi

  • Canada
View GitHub Profile
@haleyngonadi
haleyngonadi / bootstrap-button-toggle-on-off-switch.markdown
Created March 28, 2021 22:49
Bootstrap Button Toggle (On/Off Switch)

Bootstrap Button Toggle (On/Off Switch)

Working on a client project that will be using Bootstrap, and needed to build a toggle/switch that came in a couple different sizes. I wasn't seeing that as a built-in option within Bootstrap, and I didn't really like the ones already out there that I found from a quick search (I didn't want to use a plugin, just wanted it to utilize Bootstrap's built-in JS), so I decided to make my own.

This example is just using the default "Quick Add" Bootstrap CSS & JS, no added/custom JS on my part, I've simply utilized Bootstrap's buttons.js Single Toggle method (http://getbootstrap.com/javascript/#buttons) and added some custom styling (LESS).

A Pen by Aanjulena Sweet on CodePen.

License.

<?php
...
Router::scope('/artist', ['controller' => 'Artists'], function ($routes) {
$routes->connect('/:id/:name', ['action' => 'view'], ['pass' => ['id']]);
});