MrMAG
MrMAG

Reputation: 1264

How to switch between custom css layout and bootstrap css layout

I want a little dropdown menu on my sample-page to toggle between a custom layout and a bootstrap layout. Is there a way to do this in javascript / jquery?

Upvotes: 0

Views: 205

Answers (1)

benomatis
benomatis

Reputation: 5633

Setup a class (or more) in CSS that will contain your custom styles, then use jQuery to add or remove that class to / from the relevant element(s).

In jQuery, you can use the toggleClass function for that.

CSS:

.my-layout {
    /* do your custom styling */
}

JS:

$('#swap-layout').click(function() {
    $('#dropdown').toggleClass('my-layout');
});

Upvotes: 1

Related Questions