【发布时间】:2016-07-13 21:37:54
【问题描述】:
我有一个背景图像设置如下:
#collection-5777203c893fc094ec1de004{
background-image: url(https://static1.squarespace.com/static/57771b9e15d5dbc2f8fc084d/57771c55e3df28c63c9e687f/57771ca7440243196bc6801b/1467423990309/Gator.jpg?format=1500w);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
我有一个链接,我想在悬停时触发背景图像更改,并且我希望它在未悬停在链接上时返回原始图像。
我已使用此 jquery 更改背景图像:
<script>
jQuery('#block-5777203c893fc094ec1de005').hover(function()
{
jQuery('#collection-5777203c893fc094ec1de004').css("background-image", "url(https://static1.squarespace.com/static/57771b9e15d5dbc2f8fc084d/57771c55e3df28c63c9e687f/57771d441b631b48a1362df6/1467424076131/patagoniawater.jpg?format=750w)");
});
</script>
谁能告诉我在不将鼠标悬停在链接上时将图像返回到其原始背景图像的代码?
图像也发生了轻微的变化。我不确定是否可以做些什么来使更改更顺利。
提前致谢。
【问题讨论】:
标签: jquery