Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何为导航制作背景幻灯片>;ul标签?_Javascript_Jquery_Html_Css_Slideshow - Fatal编程技术网

Javascript 如何为导航制作背景幻灯片>;ul标签?

Javascript 如何为导航制作背景幻灯片>;ul标签?,javascript,jquery,html,css,slideshow,Javascript,Jquery,Html,Css,Slideshow,我想每隔几秒钟更改一次图像背景。 横幅1横幅2。。。 我的css代码: nav>ul{ width: 529px; height: 529px; background: url(../images/banner1.png) center no-repeat; position: absolute; top: 50%; margin: -216px -260px; left: 50%; z-index: 50; } html代

我想每隔几秒钟更改一次图像背景。 横幅1横幅2。。。 我的css代码:

nav>ul{
    width: 529px;
    height: 529px;
    background: url(../images/banner1.png) center no-repeat;
    position: absolute;
    top: 50%;
    margin: -216px -260px;
    left: 50%;
    z-index: 50;
}
html代码:

<nav>
<ul>
anything
</ul>
</nav>

    任何东西

您可以使用此jQuery插件制作背景幻灯片。它将拉伸任何图像以适合容器元素

您只需包含插件并编写类似于以下内容的脚本:

<script>
$(".container-element-class").backstretch([
      "path-to-your/image1.jpg"
    , "path-to-your/image2.jpg"
    , "path-to-your/image3.jpg"
  ], {duration: 3000, fade: 750});
</script>

$(“.container元素类”).backstretch([
“指向您的/image1.jpg的路径”
,“指向您的/image2.jpg的路径”
,“指向您的/image3.jpg的路径”
],{持续时间:3000,衰减时间:750});