Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property offsetWidth of 'undefined' #4

Closed
kikito opened this issue Oct 15, 2012 · 4 comments
Closed

Cannot read property offsetWidth of 'undefined' #4

kikito opened this issue Oct 15, 2012 · 4 comments
Assignees

Comments

@kikito
Copy link

kikito commented Oct 15, 2012

I'm getting that error on this line:

// around line 212 in bootstrap-modalmanajer.js
this.$loading[0].offsetWidth

When I execute this:

GlobalModalManager.loading();

I suspect that [0] behind $loading has something to do with this error.

@jschr
Copy link
Owner

jschr commented Oct 15, 2012

Do you have a page where I can see the error or possibly a jsfiddle? Can't seem to reproduce this on the demo page.

Thanks

@kikito
Copy link
Author

kikito commented Oct 15, 2012

I'm not sure how or why this was happening but I was able to fix the issue by moving all the script tags to the end of my layout's body tag, instead of loading them all in the head section.

I might be completely wrong, but bootstrap-modal might be attempting to load nodes (i.e. $('body')) when they are not necessarily there yet.

For now, I'll just move my things down.

@jschr
Copy link
Owner

jschr commented Oct 15, 2012

Ah yes, the modal manager class creates a default manager on page load attached to body so that sounds like it could be it. While I believe that it's a better practice to have JS files at the bottom of the page, I do not want to enforce it so I will look at fixing this. At the very least I will update the installation with this info.

Thanks for looking into this.

@jschr jschr closed this as completed Oct 15, 2012
@ghost ghost assigned jschr Oct 15, 2012
@jschr jschr reopened this Oct 15, 2012
@jschr
Copy link
Owner

jschr commented Oct 24, 2012

should be fixed now

@jschr jschr closed this as completed Oct 24, 2012
thurloat pushed a commit to thurloat/bootstrap-modal that referenced this issue Jan 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants