简体   繁体   English

Javascript幻灯片-更改div的背景图片

[英]Javascript Slideshow - change div's background image

I am new to the web development world and I am still figuring things out. 我是Web开发领域的新手,我仍然在解决问题。

So, I am trying to change a div's background image using javascript, and make it like a slideshow. 因此,我正在尝试使用javascript更改div的背景图像,并使其像幻灯片一样。 I've already tested some scripts slideshow tutorials but they haven't worked so far. 我已经测试了一些脚本幻灯片演示教程,但到目前为止还没有奏效。 Any ideas? 有任何想法吗? (In need to do this without the use of any webkits or jquery). (无需使用任何Webkit或jquery即可执行此操作)。

The HTML code with the The CSS code HTML代码CSS代码

<div id="container">
    <article>
        <section id="order"> 
            <center>
                <a href="order.html">
                    <acronym title="order now">
                        <img src="images/ordernow.png" id="orderBut">
                    </acronym>
                </a>    
            </center>
        </section>
    </article> 
</div>

#container
{
    border-style:solid;
    border-radius: 10px;
    width:90%;
    height:500px;
    margin-left:50px;
    clear:both;
    line-height:0;
    background-image: url(images/pizzabite.jpeg); 
    background-size: 100%;
}

since you are starting on coding out a slide show, why don't you try this simple slider with the full code provided. 由于您是开始为幻灯片显示编码的,所以为什么不尝试使用提供的完整代码来使用这个简单的滑块。 You could learn from there like i did. 您可以像我一样从那里学习。

http://fancybox.net/ http://fancybox.net/

http://jquery-plugins.net/divas-slider-multipurpose-responsive-jquery-slider (More sophisticated) http://jquery-plugins.net/divas-slider-multipurpose-sensitive-jquery-slider (更为复杂)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM