我有一个灰度图像,所以当使用 jQuery mouseenter 时,它会变为彩色版本。这是我的代码...
$(function(){
$(document).on('mouseenter', '.items', function() {
img = $(this).data('img');
img2 = img.replace(".", "C.");
$(this).css("background-image", "url(img/" + img2 + ")");
}).on('mouseleave', '.items', function() {
$(this).css("background-image", "url(img/" + img + ")");
});
});
顺便说一句……问题是这种“过渡/变化”的方式并不顺利,就像页面刷新时一样,就像“火花”一样。所以不是一个好的呈现方式。谁能告诉我我能做些什么来解决这个问题?谢谢...