我有 5 张图像,我需要的操作是悬停和单击该特定图像的颜色变化,其余的将与非事件状态相同,如果我单击新图像,新图像颜色应该改变,其余将处于非事件模式(以前的颜色),图像演示在 example 中给出我不知道该怎么做,请给我一步一步的过程。
请帮帮我,, 提前致谢..
最佳答案
$(document).ready(function() {
// Below code will be executed when you hover or click on image
$('img').on('hover click', function(e) {
// Remove active Class From All Image
$('img').removeClass("active");
// Add Active Class To Image on which you hover or click
$(this).addClass("active")
});
})
关于jquery 悬停图像更改与事件非事件功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34614607/