Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Uncaught TypeError: undefined is not a function #9

Closed
DaveLindberg opened this issue Apr 7, 2015 · 15 comments
Closed

Uncaught TypeError: undefined is not a function #9

DaveLindberg opened this issue Apr 7, 2015 · 15 comments

Comments

@DaveLindberg
Copy link

I'm getting the following error when loading my page with bootstrap.offcanvas.js installed:

Uncaught TypeError: undefined is not a functionbootstrap.offcanvas.js?ver=4.0:229 (anonymous function)bootstrap.offcanvas.js?ver=4.0:253 (anonymous function)

Loading bootstrap.offcanvas.min.js produces the same result.

@iamphill
Copy link
Owner

iamphill commented Apr 7, 2015

@DaveLindberg What line is the error on? Do you get the error on http://iamphill.github.io/Bootstrap-Offcanvas/example.html?

@DaveLindberg
Copy link
Author

http://iamphill.github.io/Bootstrap-Offcanvas/example.html is coming up clean.

Looks like the error (on my install) is on line 229. JSHint throws warnings on:
line 233
return oc = "Did you mean to return a conditional instead of an assignment? — column 18"
line 237
return $(this).on('click', function(e) { "'e' is defined but never used. — column 43"
I installed the components using bower.

@iamphill
Copy link
Owner

iamphill commented Apr 7, 2015

@DaveLindberg Hmm.. 229 would be https://github.com/iamphill/Bootstrap-Offcanvas/blob/master/dist/js/bootstrap.offcanvas.js#L229 which would surely mean that $ isn't available. jQuery is available right?

@DaveLindberg
Copy link
Author

Confirmed, jQuery is loading properly — before the bootstrap.offcanvas.js

@iamphill
Copy link
Owner

iamphill commented Apr 7, 2015

@DaveLindberg Could you upload a demo somewhere where it isn't working?

@DaveLindberg
Copy link
Author

@iamphill
Copy link
Owner

iamphill commented Apr 7, 2015

@DaveLindberg Ah I see the issue, angularJS redefines the $ variable. Will get a fix out ASAP.

@DaveLindberg
Copy link
Author

Fantastic, thanks!

@iamphill
Copy link
Owner

iamphill commented Apr 7, 2015

@DaveLindberg Just released 1.3.5 if you could try that.

@DaveLindberg
Copy link
Author

I've posted the v1.3.5 version to http://webdev.davelindberg.com/
Still getting an error. Line 149?

@iamphill
Copy link
Owner

iamphill commented Apr 8, 2015

@DaveLindberg Just checked your demo, and it is still showing the older version?

Just created a PR anyway with a test. Could you try using #10 ?

@DaveLindberg
Copy link
Author

#10 is working fine on my local install. Oddly, it still throws an error on webdev. I've check the two files and found no diff, not sure what's happening here?

@DaveLindberg
Copy link
Author

Thx. Not sure why, but there's a trailing newline on the webdev version that I can't get rid of — don't know why. Other than that, the latest version should be in place.

And yes, this fix does the job nicely on my local server.

@iamphill
Copy link
Owner

iamphill commented Apr 9, 2015

@DaveLindberg Cool, will get it merged in.

Styling on your version is off. Looks like you haven't included Bootstrap.

@iamphill iamphill closed this as completed Apr 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants