JSFiddle - React, Tailwind, and code Playground
by Libor Šimo
HTML
<button id="pt">Pridaj triedu</button>
<button id="ot">Odober triedu</button>
<button id="css">Zmeň šírku</button>
<button id="cssp">Pôvodná šírka</button>
<div></div>
CSS
div {
margin-top:50px;
height: 100px;
width: 200px;
background-color: red;
}
.modry {
background-color: blue;
}
JavaScript
$('#pt').click(function() {
$('div').addClass('modry');
});
$('#ot').click(function() {
$('div').removeClass('modry');
});
$('#css').click(function() {
$('div').css('width','100');
});
$('#cssp').click(function() {
$('div').css('width','200');
});