I want to add the style -webkit-filter: drop-shadow(5px 5px 5px #222);
in JavaScript without jQuery.
I want create a shadow for png transparent image duration with CSS transform.
This code is not working correctly:
var scscsc = document.getElementById('scscsc');
scscsc.setAttribute("style", "-webkit-filter: drop-shadow(5px 5px 5px #222);");
scscsc.style.transform = "rotate(216deg)";
body {
margin: 0px;
padding: 0px;
text-align: center;
}
img {
position: absolute;
top: 0;
left: 0;
}
<img src="http://sirati.info/tmp/ss.png" id="scscsc">
Uzbekjon's answer will only work if that is the only CSS property you are using. It's preferable to set inline CSS using the style
property of the element like so:
var elt = document.getElementById("#your-element-id");
elt.style.setProperty("-webkit-filter", "drop-shadow(5px 5px 5px #222)");
Edit: here is a working JSfiddle demonstrating this works