jQuery allows us to modify the opacity of the elements with great ease. We already saw him doing a Fade effect.
But now we are going to something simpler, we are simply going to apply an opacity change to an image with jQuery . The idea will be to start with an image and a link that allows us to apply the opacity.
Opacity with jquery
$(document) .ready (function () {
$("#opacity").click (function(e){
$("#logo").css("opacity", 0.2);
});
});
And it is that it will be in the click event where we will apply the opacity change. The opacity change is achieved by modifying the opacity property of CSS. To do this we will use the method .css of jQuery.
It is important to know that the opacity values vary between 0.0 and 1.0
Be the first to post a comment.