Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.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 有人知道我的代码有什么问题吗?我正在制作一个渐弱的幻灯片?_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 有人知道我的代码有什么问题吗?我正在制作一个渐弱的幻灯片?

Javascript 有人知道我的代码有什么问题吗?我正在制作一个渐弱的幻灯片?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我试图用jQuery制作一个淡入淡出的幻灯片,但是 我似乎不能让它去是我的代码中有什么错误或你们有任何其他的捷径,使这项工作?还有其他方法制作淡入淡出幻灯片吗 <!DOCTYPE html> <html> <head> <style type="text/css"> <!-- #wrap { margin-top: 0px; margin-right: auto;

我试图用jQuery制作一个淡入淡出的幻灯片,但是 我似乎不能让它去是我的代码中有什么错误或你们有任何其他的捷径,使这项工作?还有其他方法制作淡入淡出幻灯片吗

  <!DOCTYPE html>
    <html>
    <head>
    <style type="text/css">
    <!--
    #wrap {
        margin-top: 0px;
        margin-right: auto;
        margin-bottom: 0px;
        margin-left: auto;
        height: 375px;
        width: 960px;
        overflow: hidden;
    }
    #wrap img {
        display: none;
    }
    #wrap .is-showing {
        display: inline;
    }

    -->
    </style>


    </head>
    <body>

        <div id="wrap">
            <img src="images/image1.jpg" width="960" height="375" alt="image 1" class="is-showing" />
            <img src="images/image2.jpg" width="960" height="375" alt="image 2" class="is-showing" />
            <img src="images/image3.jpg" width="960" height="375" alt="image 3" class="is-showing" />
        </div>
    <script type="text/javascript" src="jquery-1.11.1min.js" </script>
    <script type="text/javascript">
        $(document).ready(function() {
        slideshow();

        });

        function slideshow() {
            var showing = $('#Wrap .is-showing');
            var next = showing.next().length ? showing.next () ; showing.parent().children(':first');

        showing.fadeout(800, function() { next.fadeIn(800).addClass('.is-showing'); }).removeClass('.is-showing');

        setTimeout(slideshow, 2500);

        }


    </script>
    </body>
    </html>


您的
幻灯片放映
功能有很多错误,包括打字错误,而且没有经过深思熟虑。不过,这是正确的:

function slideshow() {
    var showing = $('#wrap > .is-showing');
    var next;
    if (showing.length === 3) {
        next = showing.parent().children(':first');
        showing.hide();
        showing.removeClass("is-showing");
        next.show();
        next.addClass("is-showing");
    } else {
        next = showing.next();
        next = next.length ? next : next = showing.parent().children(':first');
        showing.fadeOut(800, function() { next.fadeIn(800).addClass('is-showing'); }).removeClass('is-showing');
    }
    setTimeout(slideshow, 2500);
}

你做了什么调试?你拥有创建JSFIDLE的一切。从这里开始。您确定您的脚本标记正确链接了jQuery吗?为了解决这个问题?我相信jquery安装正确,我使用了jquery警报功能来测试它是否正常工作……我还保存了jquery页面。