手动背景div幻灯片
我需要制作一个 css 背景图像淡入淡出幻灯片。由于多种原因,我的 html 中无法包含物理 div。它是一个名为 -home- 的类的主体,它具有当前的背景。幻灯片将有 4 张图片,不多不少,因此不必是动态的。
我已经有了以下 jquery:
<script type="text/javascript">
$(document).ready(function() {
var original_image = '#000000 url(images/bg_home.jpg) top center no-repeat';
var second_image = '#000000 url(images/bg_home2.jpg) top center no-repeat';
var third_image = '#000000 url(images/bg_home3.jpg) top center no-repeat';
var fourth_image = '#000000 url(images/bg_home4.jpg) top center no-repeat';
$('.home').click(function() {
$(this).css('background', second_image);
});
});
</script>
因此,正如您所看到的,这是一个非常简单的脚本,只有在我单击常规 -home- div 时才有效。谁能帮我将其转换为简单的淡入淡出幻灯片而不需要任何点击?它应该刚刚开始执行淡入淡出幻灯片加载。
非常感谢!
I need to make a css background image fade slideshow. For several reasons, i cannot have a physical div in my html. It's the body with a class called -home- that has a current background. There will be 4 pictures for the slideshow, no more, no less, so that doesn't have to dynamic.
I already have the following jquery:
<script type="text/javascript">
$(document).ready(function() {
var original_image = '#000000 url(images/bg_home.jpg) top center no-repeat';
var second_image = '#000000 url(images/bg_home2.jpg) top center no-repeat';
var third_image = '#000000 url(images/bg_home3.jpg) top center no-repeat';
var fourth_image = '#000000 url(images/bg_home4.jpg) top center no-repeat';
$('.home').click(function() {
$(this).css('background', second_image);
});
});
</script>
So, as you see this is a very simple script that only works if i click the general -home- div. Can anyone help me with transforming this into a simple fade slideshow without any click? It should just start executing the fade slideshow onload.
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
建议:
Suggestion: