Topic: sidenav - jQuery issue
stef.kariotidis pro asked 7 years ago
jQuery.Deferred exception: $(...).sideNav is not a function TypeError: $(...).sideNav is not a function
my scripts loading order:
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"
integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"
integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn"
crossorigin="anonymous"></script>
<script src="{{ mix('js/app.js') }}"></script>
where app.js
calls the $('.button-collapse').sideNav();
Any help would be grateful.
D'Artagnan free answered 3 years ago
jquery.min.js:2 Uncaught TypeError: $(...).sideNav is not a function at HTMLDocument. (index.php:386) at e (jquery.min.js:2) at t (jquery.min.js:2)
Mikołaj Smoleński staff commented 3 years ago
It looks like you're a free user and have no access to pro component.
Keep coding, Mikołaj from MDB
dmakhkamov pro answered 6 years ago
dmakhkamov pro commented 6 years ago
Nevermind, replaced the js files from PRO folder. it started working. apparently i was working with the Free version JS files beforeMarta Wierzbicka staff commented 6 years ago
Sidenav is a pro component, so it needs premium javascript code.badjina pro answered 7 years ago
window.$ = window.jQuery = require('jquery');
and recompile js and it will work finerjdavid pro answered 7 years ago
I'm going to re-open this issue because I'm using MeteorJS and I'm getting this error. Since we need parallel loading of javascript assets to make initial access fast, sometimes, the call to the sidenav() function was performed even before loading mdb.js.
Here is my temporary solution:
waitForSideNav() { if (typeof$(".button-collapse").sideNav!=='undefined' && $.isFunction($(".button-collapse").sideNav)) { $(".button-collapse").sideNav(); } else { setTimeout(this.waitForSideNav, 100); } }
All I have to do is to call waitForSideNav()
This is not an elegant solution but it works!
Adrian Sawicki free answered 7 years ago
stef.kariotidis pro answered 7 years ago
app.js
file which in turn is loaded last in the page. For some reason the sidenav
plugin does not like it.
Problem partialy solved but if anyone has an answer I am all ears.
Regards
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: Yes
- Provided link: No