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

Error while adding JQuery public methods #362

Closed
apu84 opened this issue May 26, 2016 · 2 comments
Closed

Error while adding JQuery public methods #362

apu84 opened this issue May 26, 2016 · 2 comments

Comments

@apu84
Copy link

apu84 commented May 26, 2016

If jquery is loaded at page footer and some trick is done make ready function to work before jquery is loaded, like described in here http://writing.colin-gourlay.com/safely-using-ready-before-including-jquery iFrameResizer thorws an exception and stops execution.

Uncaught TypeError: Cannot set property 'iFrameResize' of undefined.

Probably can be fixed if use it like,

if (window.jQuery) {$(document).ready(function () {createJQueryPublicMethod(jQuery);});}

Plunker link

@davidjbradshaw
Copy link
Owner

Having just read the article, that trick would break just about every jQuery plugin. If you want to do that I'd suggest using requireJS to late load libraries and plugins. Or just load this after jQuery at the foot of your page.

You could also avoid the jQuery 'tax' completely, I've not used it on my last couple of work projects.
http://youmightnotneedjquery.com/

@davidjbradshaw
Copy link
Owner

That said this patch will stop it crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants