JSFiddle - React, Tailwind, and code Playground
by dfjosh
HTML
<a href="javascript:;" class="smaller">smaller</a>
<a href="javascript:;" class="larger">larger</a>
<div></div>
CSS
div {
width: 50px;
height: 50px;
background: cornflowerblue;
}
JavaScript
$('a').click(function() {
if($(this).hasClass('smaller')) {
var element = $('div');
element.animate({
'width' : element.width() * 0.1,
'height' : element.height() * 0.1
});
} else if($(this).hasClass('larger')) {
var element = $('div');
element.animate({
'width' : element.width() * 10,
'height' : element.height() * 10
});
}
});