JQuery光滑的轮播没有加载,CDN加载错误

时间:2017-06-03 13:57:16

标签: jquery slick.js

JS和Jquery的新手,并且在使用bootstrap jumbotron进行加载时遇到问题。在.carousel内有4个背景图像,但是它们只按顺序加载,我在chrome检查中遇到错误,声称光滑的CDN错误,即使直接复制也是如此来自网站。如果您有任何建议,请与我们联系!

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="./resource/reset.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" 
        integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css"/>
        <link rel="stylesheet" type="text/css" href="./resource/style.css">
        <link href="https://fonts.googleapis.com/css?family=Monoton|Open+Sans:400,600,700" rel="stylesheet">
        <link rel="icon" type="image/gif" href="./resource/favicon.png">
        <title>Jumpstart</title>
    </head>
<body>
    <!--Navigation Menu-->
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Explore</a></li>
                <li><a href="#">Start a Project</a></li>
                <li><a href="#">About Us</a></li>
            </ul>
        <img class="navbar-brand navbar-right collapse 
        navbar-collapse visible-lg visible-md" src="./resource/images/logo.png" alt="Brand">
        </div>
    </nav>
    <!--Website Header with Scrolling Images-->
    <div class="carousel">
        <div class="jumbotron background jumbotron-bike">
            <div class="container-fluid">
                <h1>Get Going.</h1>
                <p>Jumpstart your startup with some crowdsourced seed money, or support one of our 300,000,000+ creators and get rewards.</p>
            </div>
        </div>
        <div class="jumbotron  background jumbotron-beer">
            <div class="container-fluid">
                <h1>GET THINKING.</h1>
                <p>Meet like-minded individuals who will help fuel your creative juices.</p>
            </div>
        </div>
        <div class="jumbotron background jumbotron-flowers">
            <div class="container-fluid">
                <h1>GET CREATING.</h1>
                <p>Stop overthinking projects and begin putting them out into the world.</p>
            </div>
        </div>
        <div class="jumbotron background jumbotron-duffel">
            <div class="container-fluid">
                <h1>GET STARTED.</h1>
                <p>What are you waiting for? Today's the day for your next big idea.</p>
            </div>
        </div>
    </div>
    <div class="relative-wrapper">
                <a href="#" class="btn btn-primary btn-lg">Jump In</a>
    </div>
    <!--Featured Project-->
    <div class="container featured-project">
       <div class="row">
            <h2 class="col-xs-12">Featured Project</h2>
        </div>
       <div class="row">
            <div class="col-xs-12 col-md-6">
                <div class="image-container">
                    <a href="#">
                        <img src="./resource/images/featured-project.png" alt="Featured Project" class="thumbnail">
                    </a>
                </div>
            </div>
            <div class="col-xs-6 col-md-3">
                <h3>Defrost: A Documentary</h3>
                <p>by Leo De Firenze</p>
                <p>"DeFrost is a documentary about growing up in a little red house in a cold, harsh valley. 
                This is a story about my mother's childhood. This film attempts to capture vignettes of her upbringing — her family, 
                friends, pets, and eventual depature from a freezing valley in Northern Italy — through beautiful cinematography and narration."
                </p>
            </div>
            <div class="col-xs-6 col-md-3 ">
                <h3>Product Categories</h3>
                <ul>
                    <li>Art</li>
                    <li>Books</li>
                    <li>Crystals</li>
                    <li>Design</li>
                    <li>Doodles</li>
                    <li>Deedlybobs</li>
                    <li>Farming</li>
                    <li>Gadgets</li>
                    <li>Hoverboards</li>
                    <li>Jams, Jellies, Etc.</li>
                    <li>Magazines</li>
                    <li>Plants</li>
                    <li>Snakes &amp; Snake Equipment</li>
                    <li>Tables</li>
                    <li>Ventriliquist Figures</li>
                    <li>Yoyos</li>
                </ul>
            </div>
        </div>
    </div>
<!--Projects List-->
    <div class="container">
       <div class="row">
            <h2 class="col-xs-12">Projects</h2>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-4 project">
                <div class="image-container">
                    <a href="#">
                        <img src="./resource/images/project1.png" alt="Proj1" class="thumbnail">
                    </a>
                </div>
                <h3>The Right Tights</h3>
                <p>by Riley Mae</p>
                <p>These tights are 50 denier, beautifully constructed, 
                    hand-dyed, and guaranteed to last (no more ladders!). Made with high quality, 
                    completely toxic-free materials. Custom colors available to all backers.
                </p>
            </div>
            <div class="col-xs-12 col-sm-4 project">
                <div class="image-container">
                    <a href="#">
                        <img src="./resource/images/project2.png" alt="Proj2" class="thumbnail">
                    </a>
                </div>
                <h3>Peppermint Smart Home</h3>
                <p>by Brian McDonald</p>
                <p>Instantly upgrade your home with technology that keeps your family and home safe. 
                    We've made Peppermint easy to use. Just talk to your phone and Peppermint will help you every step of the way.
                </p>
            </div>
            <div class="col-xs-12 col-sm-4 project">
                <div class="image-container">
                    <a href="#">
                        <img src="./resource/images/project3.png" alt="Proj3" class="thumbnail">
                    </a>
                </div>
                <h3>American Streetlife</h3>
                <p>by Patrick Wallace</p>
                <p>I've been traveling around the United States for the past two years. I've slept on hundreds of couches, 
                    more than a few benches, and captured my experiences in this 120 page photo album.
                </p>
            </div>
        </div>
    </div>
<!--Having Trouble Section-->
    <div class="container-fluid help">
        <strong>Having Trouble thinking of an idea?</strong>
        <p>Inventors’ block strikes at the worst times. But that’s 
            all changed with Jumpstart’s Good Idea Generator Lite (GIGLi).</p>
        <a href="#" class="btn btn-primary">Learn More</a>
    </div>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"
  integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="crossorigin="anonymous"></script>
    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js"></script>
    <script type="text/javascript" src="./resource/main.js"></script>
</body>
</html>'

这是Jquery代码:`$(document).ready(function(){

 $('.carousel').slick({
        autoplay: true,
        autoplaySpeed: 4000,
        arrows: false,
        fade: true,
        pauseOnFocus: false,
        pauseOnHover: false,
        // slidesToShow: 1,
        slidesToScroll: 4
    });

    var scrol = 0;


});`

它也列在git存储库中,以便在此处查看:https://github.com/solaini/Jumpstart

1 个答案:

答案 0 :(得分:0)

您的代码看起来很好。清除你的缓存&amp; cookie并尝试再次加载页面。如果您仍有问题,请尝试替换:

  • //cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js with。/resource/slick.min.js
  • //cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css./resource/slick.css

Your code works good on my browser: see this.