我可以改变我的背景图片:
$('html').css({background : 'url(http://www.cyberth.com/images/background_aporia.jpg)'});
如何在两个图像之间进行淡出和淡入过渡。如果可以避免的话,我不想为此在 Body 中使用 div。
这样的事情似乎不起作用:
$('html').not('body').fadeOut("slow");
即使我将 html 的 z 索引更改为 1 并将 body 更改为 2,设置 html 标签的不透明度也会向下级联。
我在 css 中的背景声明如下所示:
html {
background: url(http://www.cyberth.com/images/background_odonata.jpg)
no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
最佳答案
您不能将背景应用到 html,而是应用到具有 100% 宽度和高度以及负 z-index 的绝对位置的 div。然后你应该能够在不影响其他任何东西的情况下对那个 div 做任何事情。然后你甚至可以为此使用像 jquery cycle 这样的插件。 http://jquery.malsup.com/cycle/
关于jquery - 在 HTML CSS 标记中声明的背景图像之间的过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8049606/