简体   繁体   中英

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.

  • No collpase
  • No resize

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,

$(function() {

    $('#side-menu').metisMenu();

});

is not working and Uncaught TypeError: undefined is not a function

I hope... I will be helped...

Make sure you have loaded jquery first, then 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. I think loading jquery twice was the culprit in my case.

Call Metis after the view is initialised and also Make sure you have the ordered your JS libraries in correct order. 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM