我有一个网站,其中的背景图像被拉伸到适合整个屏幕。有点击的拇指钉会改变背景图像。我试图在背景图像发生变化时获得交叉淡入淡出效果,但似乎无法使其发挥作用。Animate HTML背景图片淡入淡出
现在,当点击缩略图时,整个屏幕(包括内容)淡出,然后淡入正确的背景图像。我不希望内容淡出......我只想让背景图片淡出。我认为我的问题是我告诉整个HTML页面淡出,但我不确定如何定位整个网站的背景图像。
CSS
html {
background: url(../img/01.jpg) no-repeat center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
的JavaScript
$("#wrapper #thumbs figure img").click(function() {
var id = $(this).attr('id');
$('html').fadeOut("slow", function() { });
$('html').fadeIn("slow", function() {
$('html').css('background', 'url(' + images[id] + ') no-repeat center fixed');
});
});
这将是一件好事,如果你加一个小提琴 –