I am using CSSGram on my website to make images have Instagram-like filters. This is the method below to add a filter to a image:
You can use jquery like
$('img').addClass('aden');
to add the css to all imgs
Yes apply to the container and style with css, example below:-
-webkit-filter: brightness(0.9) contrast(1.4) hue-rotate(150deg) invert(0.1);
The styles are based on a img
sitting inside figure
element. You could automatically wrap all of the images in a figure element like so
$(function() {
$("img").wrap("<figure class='aden'></figure>");
});
However, you might want to be more specific with that selector as it could break other images like logos, social icons etc
Working example here:
https://jsfiddle.net/cs9asjhs/
with JQUERY:
use addClass method
$('figure').addClass('aden')
see this fiddle
or you can use just javascript:
var a = document.querySelector('figure');
if (a.classList) {
a.classList.add('aden');
} else {
a.className += ' aden';
}
see this fiddle