我已经通读了,无法找到适合我的问题的解决方案
我正试图让光滑的旋转木马工作。我已经得到它在这里显示的jsbin上工作: http://jsbin.com/gojozobemi/1/edit?html,output
然而,当我在桌面上工作时,它会在开发控制台中显示错误,说明" Uncaught TypeError:undefined不是函数" 这是我的一些桌面代码
$(document).ready(function(){
$('.single-items').slick({
dots: true,
infinite: true,
speed: 300,
slidesToShow: 1,
adaptiveHeight: true
});
});

<div class="single-items">
<div>
<img src="http://wallpapercartoon.com/wp-content/uploads/2014/07/o-DOUG-facebook.jpg">
</div>
<div>
<img src="http://img3.wikia.nocookie.net/__cb20130803215442/nickelodeon/images/e/e2/Tumblr_lvjvhxwDiM1r6hffko1_400.jpg">
</div>
<div>
<img src="http://fc02.deviantart.net/fs70/f/2013/303/b/4/pork_chop_by_barontremaynecaple-d6sdm6s.jpg">
</div>
</div>
&#13;
我很难过为什么这会对JSBin起作用而不是在我的桌面上,任何帮助都会受到赞赏
<!DOCTYPE html>
<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<!-- If you delete this meta tag World War Z will become a reality -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<title>Coffee Site</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.3.15/slick.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/vendor/modernizr.js"></script>
<script src="js/slickini.js"></script>
</head>
<body>
<div class="contain-to-grid sticky">
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<h1><a href="#">Coffee Site</a></h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a>
</li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li class="has-form">
<div class="row collapse">
<div class="large-8 small-9 columns">
<input type="text" placeholder="Find Stuff">
</div>
<div class="large-4 small-3 columns">
<a href="#" class="alert button expand">Search</a>
</div>
</div>
</li>
</ul>
<!-- Left Nav Section -->
<ul class="left">
<li class="has-dropdown">
<a href="#">Left Button Dropdown</a>
<ul class="dropdown">
<li><a href="#">First link in dropdown</a>
</li>
<li class="active"><a href="#">Active link in dropdown</a>
</li>
</ul>
</li>
</ul>
</section>
</nav>
</div>
<!---main content goes here-->
<div class="single-items">
<div>
<img src="http://wallpapercartoon.com/wp-content/uploads/2014/07/o-DOUG-facebook.jpg">
</div>
<div>
<img src="http://img3.wikia.nocookie.net/__cb20130803215442/nickelodeon/images/e/e2/Tumblr_lvjvhxwDiM1r6hffko1_400.jpg">
</div>
<div>
<img src="http://fc02.deviantart.net/fs70/f/2013/303/b/4/pork_chop_by_barontremaynecaple-d6sdm6s.jpg">
</div>
</div>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.3.15/slick.min.js"></script>
<script src="js/vendor/jquery.js"></script>
<script src="js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</html>
&#13;
答案 0 :(得分:1)
只需将 http 或 https 添加到您的jquery.slick script
参考中。
<script type="text/javascript" src="http://cdn.jsdelivr.net/jquery.slick/1.3.15/slick.min.js"></script>
您的桌面可能有一个静态网站(没有Web服务器),因此浏览器不知道如何在没有http或https的情况下解析引用。 由于JSBin像任何托管网站一样在Web服务器上运行,浏览器知道如何解析引用。它会添加 http 或 https 获取网站网址的值。
*对link
css引用执行相同的操作。
答案 1 :(得分:0)
尝试删除jquery的双重实例(&#39; vendor / jquery.js&#39;和jquery-1.11.1.min.js&#39;)已加载..至于我知道,slick.js也遇到了旧版jquery的问题。