nyroModal
nyroModal copied to clipboard
TypeError: $(...).nyroModal is not a function
My application in rails says me this error on firebug:
TypeError: $(...).nyroModal is not a function beforeShowCont: function() {
When I call Script.js: var width = 1152; var height = 864; $('.modal').nyroModal({ sizes: { initW: width, initH: height, minW: width, minH: height, w: width, h: height }, callbacks: { beforeShowCont: function() { width = $('.nyroModalCont').width(); height = $('.nyroModalCont').height(); $('.nyroModalCont iframe').css('width', width); $('.nyroModalCont iframe').css('height', height); } } });
I change "$('.modal').nyroModal({" to $(".nyroModal").nm({ but it doesn't works. What can I do?
Thanks.
Did you load jQuery and complete nyroModal scripts BEFORE you load your script.js?
Same error for me, using Jquery 1.9
Did you load jQuery and complete nyroModal scripts BEFORE calling nyroModal? If so, could you provide a test page?
For some obscure reason $.fn.extend is called after.
I guess what happen is
1- Page load 2- OnReady => Trigger an event 3- File included 4- My already resolved 5- Niro OnReady resolved
However, your plugin is the only one to crash with the scheme.
I can't provide an example because the app is too huge and we're using the plugin on a private page.
Without an example or a way to reproduce the bug, I won't be able to fix it... Maybe you can create a JsFiddle to show it?
I bumped into this same issue. In my case the problem was caused either by upgrading jQuery, or by putting jQuery into noconflict mode.
The problem is caused the way that the NyroModal functions are defined:
jQuery(function($, undefined) { ... });
These functions are executing after jQuery(document).ready()
, which triggers the "$(...).nyroModal is not a function"
warning.
I was able to resolve the error by replacing each instance of:
jQuery(function($, undefined) { ... });
with an anonymous function:
(function($) { ... })(jQuery);
Now those functions execute immediately instead of after document ready.