My goal is to create a pulsating effect using CSS box-shadow through jQuery. Despite my best efforts, the code I attempted failed to produce the desired smooth pulse effect with box-shadow.
The code snippet I experimented with:
<div class="one">
</div>
The accompanying CSS styling:
.one {
width: 100px;
height: 100px;
background: red;
-webkit-box-shadow: -1px -1px 5px rgba(50, 50, 50, 0.75);
-moz-box-shadow: -1px -1px 5px rgba(50, 50, 50, 0.75);
box-shadow: -1px -1px 5px rgba(50, 50, 50, 0.75);
}
.two {
width: 100px;
height: 100px;
background: red;
-webkit-box-shadow: -1px -1px 13px rgba(50, 50, 50, 0.75);
-moz-box-shadow: -1px -1px 13px rgba(50, 50, 50, 0.75);
box-shadow: -1px -1px 13px rgba(50, 50, 50, 0.75);
}
Lastly, the jQuery script:
$("div").setInterval(function() {
$(this).toggleClass(".two");
}, 1000);
You can view the fiddle here.