jquery method to achieve two image gradient toggle effects
- 2020-06-19 09:48:12
- OfStack
This article shows how jquery can achieve two image transitions. Share to everybody for everybody reference. The details are as follows:
This code shows how jquery can switch between two images by setting 1 background image for id=kitten and fade-in and fade-out for div
html code
<div id="kitten">
<img src="/images/kitten.jpg" alt="Kitten" />
</div>
jquery code
$("#kitten").hover(function(){
$(this).find("img").fadeOut();
}, function() {
$(this).find("img").fadeIn();
});
I hope this article has been helpful for your jquery programming.