gpt4 book ai didi

TypeError: $(...).perfectScrollbar is not a function(TypeError:$(...).Perfect滚动条不是函数)

转载 作者:bug小助手 更新时间:2023-10-25 11:15:56 36 4
gpt4 key购买 nike



I am trying to createa "Perfect Scrollbar" using this:

我正在尝试创建一个“完美的滚动条”,它是这样的:


https://github.com/noraesae/perfect-scrollbar-bower

Https://github.com/noraesae/perfect-scrollbar-bower


With the most simple possible code:

使用尽可能简单的代码:


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<link rel="stylesheet" href="/css/perfect-scrollbar.css" />
<script src="/js/perfect-scrollbar.js"></script>

<script type="text/javascript">
$(document).ready(function(){
$("#msgid").html("This is Hello World by JQuery.");
$('#msgid').perfectScrollbar();
});
</script>

<div id="msgid"></div>

And I have the followin error:

我犯了以下错误:



TypeError: $(...).perfectScrollbar is not a function



Of course every js/css is pointing to the right direction, if needed you can see it live here:

当然,每个js/css都指向正确的方向,如果需要,您可以在这里看到它:


http://florida.red111.net/a.html

Http://florida.red111.net/a.html


Looks like jQuery is not recognizing the library,

看起来jQuery无法识别该库,


Any ideas?

有什么主意吗?


Thanks in advance.

先谢谢你。


更多回答
优秀答案推荐

You might not have the jQuery enabled version. This code worked for me:

您可能没有启用jQuery的版本。这段代码对我很有效:








<title>Test</title>
<!-- META -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- SCRIPTS -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.perfect-scrollbar/0.6.7/js/min/perfect-scrollbar.jquery.min.js"></script>
<script type="text/javascript">

$(document).on('ready', function() {

console.log('HELLO!');

$('.id-parent').perfectScrollbar();

});

</script>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery.perfect-scrollbar/0.6.7/css/perfect-scrollbar.min.css" />
<style type="text/css">

.id-parent {
position: relative;
overflow: auto;
height: 200px;
}

.id-child {
height: 1000px;
}

</style>

</head>




<div class="id-parent">
<div class="id-child">
<h1>Content goes here</h1></div>
</div>






I was also having the same issue. I was calling the perfectScrollbar function before it's declaration. Changing the order worked for me.

我也有同样的问题。我在声明之前调用了Perfect tScrollbar函数。改变顺序对我很管用。



I had the same issue. I was using perfect-scrollbar.jquery.js with jQuery 1.6.1. After updating jQuery to 2.1.4, the error disappeared and everything worked as expected!

我也有同样的问题。我在jQuery 1.6.1中使用的是Perfect-scllbar.jquery.js。在将jQuery更新到2.1.4之后,错误消失了,一切都按预期进行了!



Try updating jQuery, it solved the problem in my case.

尝试更新jQuery,它解决了我的问题。



Just update your perfect scrollbar on 0.5.2 version.
It's work for me.

只需更新0.5.2版本的完美滚动条即可。这是我的工作。



Recently stumbled upon similar issue. But in my case, the required JavaScript & CSS files were wrongly imported resulting in TypeError

最近偶然发现了类似的问题。但在我的例子中,错误地导入了所需的JavaScript和CSS文件,导致了TypeError


<link rel="stylesheet" href="/css/perfect-scrollbar.css"/>
<script src="/js/perfect-scrollbar.js"></script>

更多回答

If it worked for you please choose the answer as the correct answer

如果对您有效,请选择正确答案

Confirmed. Same problem, same solution. ` <script type="text/javascript" language="javascript" src="themes/material-dashboard/js/material.min.js"></script> <script type="text/javascript" language="javascript" src="themes/material-dashboard/js/perfect-scrollbar.jquery.min.js"></script> <script type="text/javascript" language="javascript" src="themes/material-dashboard/js/material-dashboard.js"></script> `

确认同样的问题,同样的解决方案。``

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com