我得到了错误:当我尝试使用可滚动时,$(".scrollable").scrollable不是一个函数
<html>
<head>
<script type="text/javascript" src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script>
</head>
<body>
<script>
$(function() {
// initialize scrollable with mousewheel support
$(".scrollable").scrollable({ vertical: true, mousewheel: true });
});
</script>
</body>
</html>有人能看出是什么原因造成的吗?
编辑
在Mark指出我使用的库已经捆绑了jQuery之后,我删除了Google引用(没有显示在上面),然后我得到了'$不是一个函数‘错误。
那时我知道jQuery和flowplay有冲突,所以我更新了我的页面以使用
jQuery.noConflict();
jQuery(document).ready(function()){
// jQuery('#foo) .... etc
});这有点烦人,因为我必须更改现有页面中的脚本,以使用jQuery而不是$。
我是否可以继续使用$,还是必须使用jQuery?
发布于 2012-09-19 16:42:33
// you don't have to use jQuery(document).ready(function()){});
// or noConflict
$ = null; // doean't matter here what happens to $
// just wrap your jQuery code passing in jQuery...
(function ($) {
//write jQuery here...
$(".scrollable").scrollable({
vertical: true,
mousewheel: true
});
})(jQuery);发布于 2011-03-13 18:52:49
查看您的代码,我认为您缺少了jQuery库。您可以从google中包含它。
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>来源:http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/
发布于 2012-04-27 07:33:49
使用
var $j=jQuery.noConflict();因为javascript也使用$符号,所以会出现冲突。然后,您可以按以下方式编写代码
$j(document).ready(function()){
// jQuery('#foo) .... etc
});https://stackoverflow.com/questions/5291486
复制相似问题