<div class="slide-background a" style="" data-bg="images/1new.jpg">
</div>
我希望在悬停div时能够平滑地更改data-bg照片
我试图用css盘旋
div.slide-background.a:hover{;background-image: url("../images
/1newcolor.jpg") !important;}
但我希望顺利改变。
答案 0 :(得分:0)
你可以用jquery做到这一点......
$( ".slide-background" ).hover(function() {
$(".slide-background").attr("data-bg", "some_other_img.jpg");
});
答案 1 :(得分:0)
使用jquery很容易,
$(".slide-background").hover(function()
{
$(".slide-background").attr("data-bg", "url.jpg");
});