只是试图让 jquery 的 nivo 滑块插件在基本的 rails 应用程序上工作。尝试了我能做的最简单的概念证明,只是将演示放入公共文件夹中的静态 html 页面,但我仍然无法让它工作。这是我正在使用的当前标题:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html lang="en">
<head>
<script type="text/javascript" src="../vendor/assets/javascripts/nivo-slider/demo/scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../vendor/assets/javascripts/nivo-slider/jquery.nivo.slider.js"></script>
<title>Nivo Slider Demo</title>
<link rel="stylesheet" href="../vendor/assets/javascripts/nivo-slider/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../vendor/assets/javascripts/nivo-slider/themes/light/light.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../vendor/assets/javascripts/nivo-slider/themes/dark/dark.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../vendor/assets/javascripts/nivo-slider/themes/bar/bar.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../vendor/assets/javascripts/nivo-slider/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../vendor/assets/javascripts/nivo-slider/demo/style.css" type="text/css" media="screen" />
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider();
});
</script>
</head>
每次在heroku中加载时都会出现错误:ReferenceError:
$ is not defined
$(window).load(function() {
一般来说,我对 Web 开发还很陌生,但我只是不知道如何解决这个问题。想法?