[英]I use sb admin2, but i don't know that side bar is not working because of metis menu
my side bar is not working. 我的侧边栏不起作用。
because 因为
Uncaught TypeError: undefined is not a function sb-admin-2.js:3(anonymous function) sb-admin-2.js:3j jquery.js:3094k.fireWith jquery.js:3206n.extend.ready jquery.js:3412I jquery.js:3428
Uncaught TypeError: undefined is not a function (index):679(anonymous function) (index):679fire jquery.js:974self.fireWith jquery.js:1084jQuery.extend.ready jquery.js:406DOMContentLoaded
I think that In sb-admin-2.js, 我认为在sb-admin-2.js中,
$(function() {
$('#side-menu').metisMenu();
});
is not working and Uncaught TypeError: undefined is not a function 无法正常工作并且出现TypeError错误:undefined不是一个函数
I hope... I will be helped... 希望...会有所帮助...
Make sure you have loaded jquery first, then sb-admin-2.js. 确保先加载了jquery,然后加载了sb-admin-2.js。 Also make sure you only load them once. 还要确保只加载一次。
I had the same problem and found that I had accidentally loaded both jquery and sb-admin-2.js twice, once directly with a tag and once as part of a bundle of multiple javascript files. 我遇到了同样的问题,发现我不小心同时加载了jquery和sb-admin-2.js两次,一次直接使用标记,一次作为多个JavaScript文件捆绑的一部分。 I think loading jquery twice was the culprit in my case. 我认为两次加载jquery是我的罪魁祸首。
Call Metis after the view is initialised and also Make sure you have the ordered your JS libraries in correct order. 初始化视图后,请调用Metis,并确保以正确的顺序订购了JS库。 For me the sequence is as follows: 对我来说,顺序如下:
<script src="/js/jquery.js"></script>
<script src="/js/jquery.3.1.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="/assets/global/plugins/select2/js/select2.js" type="text/javascript"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.