I'd like to make all my bootstrap toggles of mini
size if the page size < 768px and back to normal again once it is more than that. For all other controls I'm using @media (max-width: 768px) {
css, but I could not figure out what styles to add to make bootstrap toggle mini
size.
One of other approaches I tried is:
window.addEventListener('resize', function() {
if ($(window).width() < 768) {
$("[data-toggle='toggle']").bootstrapToggle({size: "mini"});
}
}, true);
But that reinitializes all bootstrap toggles, removing all the setup made with data- attributes. I would also prefer css approach.