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

TypeError: $(...).nyroModal is not a function #251

Open
ghost opened this issue Dec 16, 2014 · 6 comments
Open

TypeError: $(...).nyroModal is not a function #251

ghost opened this issue Dec 16, 2014 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 16, 2014

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.

@nyroDev
Copy link
Owner

nyroDev commented Feb 21, 2015

Did you load jQuery and complete nyroModal scripts BEFORE you load your script.js?

@Masadow
Copy link

Masadow commented Mar 24, 2015

Same error for me, using Jquery 1.9

@nyroDev
Copy link
Owner

nyroDev commented Mar 27, 2015

Did you load jQuery and complete nyroModal scripts BEFORE calling nyroModal?
If so, could you provide a test page?

@Masadow
Copy link

Masadow commented Mar 27, 2015

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.

@nyroDev
Copy link
Owner

nyroDev commented Apr 4, 2015

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?

@jnicol
Copy link

jnicol commented Jun 1, 2015

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.

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

3 participants