【发布时间】:2013-12-29 15:58:16
【问题描述】:
在这里,我尝试使用 jQuery 滑块通过为其背景位置设置动画来创建背景图像滑块。 这是我的 html 和 CSS
<div id="sliderWrapper">
</div>
#sliderWrapper
{
/*background-color: transparent;*/
width: 620px;
height: 349px;
background-image: url(images/1.png), url(images/2.jpg);
background-position: 0px 0px, 620px 0px;
background-repeat: no-repeat,no-repeat;
background-size: cover,cover;
-webkit-background-size: cover,cover;
-moz-background-size: cover,cover;
}
$('#sliderWrapper').animate({
'backgroundPosition':'-620px 0px,0px 0px'
}, 1500);
backgroundPosition 的动画不工作
我阅读了很多博客使用以下内容
backgroundPositionX:'-640px';
它适用于具有单个背景图像的 div。但我不知道如何处理具有多个背景图像的 div。
【问题讨论】:
-
你能解释一下吗?
标签: javascript jquery html css