Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.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 实现JQuery Scrollbox-修改函数-不确定如何实现_Javascript_Jquery_Function_Scripting - Fatal编程技术网

Javascript 实现JQuery Scrollbox-修改函数-不确定如何实现

Javascript 实现JQuery Scrollbox-修改函数-不确定如何实现,javascript,jquery,function,scripting,Javascript,Jquery,Function,Scripting,我正在处理一个博客,我想在我的div框中放置一个JQuery滚动条,作为主要内容区域。我对JS有点陌生,但我想我错过了一些东西。开发人员提供了一个脚本,但我不相信它是正确的。只是附带说明:所有库都是在脚本之前加载的,所以我认为这不是问题所在。以下是我目前拥有的(减去所有Sql垃圾): 我想萤火虫说得比我好。我没有看到这里定义的函数。如果必须包含该函数,我不确定该函数是什么。我觉得您好像还没有包含jQuery插件脚本 mCustomScrollbar不是jQuery的一部分,您需要引用插件 这听起

我正在处理一个博客,我想在我的div框中放置一个JQuery滚动条,作为主要内容区域。我对JS有点陌生,但我想我错过了一些东西。开发人员提供了一个脚本,但我不相信它是正确的。只是附带说明:所有库都是在脚本之前加载的,所以我认为这不是问题所在。以下是我目前拥有的(减去所有Sql垃圾):


我想萤火虫说得比我好。我没有看到这里定义的函数。如果必须包含该函数,我不确定该函数是什么。

我觉得您好像还没有包含jQuery插件脚本

mCustomScrollbar
不是jQuery的一部分,您需要引用插件

这听起来像是您正在谈论的插件,包括其中的脚本参考:
我想出来了。如果有人想知道:

我是通过对演示脚本进行反向操作并找出答案来实现的。基本上我没有做的就是把CSS排好,我也没有把脚本放在正确的目录中

至于合适的脚本:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/minified/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script>
<!-- custom scrollbars plugin -->
<script src="jquery.mCustomScrollbar.concat.min.js"></script>
<script>
(function($){
$(window).load(function(){
$(".body,.content").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
});
})(jQuery);
</script>

!window.jQuery&&document.write(unescape(“%3Cscript src=”js/minified/jQuery-1.9.1.min.js”%3E%3C/script%3E'))
(函数($){
$(窗口)。加载(函数(){
$(“.body.content”).mCustomScrollbar({
滚动按钮:{
启用:true
}
});
});
})(jQuery);
基本上,我在中添加了.body并更改了.content,使其与我的主样式表相对应。除此之外,您的页面上不需要任何css:

<style>
body>.mCustomScrollBox>.mCSB_scrollTools{top:2%; height:96%;}
</style>

body>.mCustomScrollBox>.mCSB_滚动工具{顶部:2%;高度:96%;}

那是我丢失的钥匙

请向我们展示您正在加载的脚本以及我编辑以添加所有代码的顺序。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/minified/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script>
<!-- custom scrollbars plugin -->
<script src="jquery.mCustomScrollbar.concat.min.js"></script>
<script>
(function($){
$(window).load(function(){
$(".body,.content").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
});
})(jQuery);
</script>
<style>
body>.mCustomScrollBox>.mCSB_scrollTools{top:2%; height:96%;}
</style>