i am trying to change the box shadow on the click on the div here is my code
index.html
<html>
<head>
<script src="jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="ttt"></div>
<script src="script.js"></script>
</body>
</html>
script.js
$(document).ready(function () {
var state = false;
$("#ttt").click(function () {
if (state) {
$("#ttt").animate({
'boxShadowX': '10px',
'boxShadowY': '10px',
'boxShadowBlur': '20px'
});
} else {
$("#ttt").animate({
'boxShadowX': '3px',
'boxShadowY': '3px',
'boxShadowBlur': '3px'
});
}
console.log(state);
state = !state;
});
});
style.css
#ttt{
padding-left: 100px;
padding-top: 100px;
padding-right: 100px;
padding-bottom: 100px;
width: 100px;
height: 100px;
background-color: red;
border-radius: 10px;
box-shadow: 10px 10px 5px #888888;
}
how can i use jquery to toggle the box-show to animate from fully visible to thin when the mouse is clicked on it ?