JSFiddle - React, Tailwind, and code Playground
by deshg
HTML
<div id="container">
<img src="https://dl.dropboxusercontent.com/s/3o4xrlvax9b08u4/svghover.svg" class="svghover">
</div>
CSS
#container {
width: 100%; background-color: #000000;
}
img {
width: 100px;
height: 100px;
}
JavaScript
$(document).on({
mouseenter: function () {
var t = $(this);
t.attr("src", function(index, attr){
var src = t.attr("src");
return attr.replace(src, "https://dl.dropboxusercontent.com/s/rga8anccnpyublh/svg.svg");
});
},
mouseleave: function () {
var t = $(this);
t.attr("src", function(index, attr){
var src = t.attr("src");
return attr.replace(src, "https://dl.dropboxusercontent.com/s/3o4xrlvax9b08u4/svghover.svg");
});
}
}, "img.svghover");