You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i wanted to combine the game with an countdown,so i have added the https://github.com/wimbarelds/TimeCircles Countdown which works fine. Now i'd like to add a handleTimeout() function in the plugin init function and call it like from the countdown callback. i changed the initialisation to
$.fn.quizyMemoryGame = function(optionsMethods) {
if ( methods[optionsMethods] ) {
return methods[ optionsMethods ].apply( this, arguments);
} else if ( typeof optionsMethods === 'object' || ! optionsMethods ) {
methods.init.apply(this, arguments);
return methods.init;
} else {
$.error( 'Method ' + optionsMethods + ' does not exist on jQuery.tooltip' );
}
}
to get a init function reference in the html page and do something like
var game = $('#my-memorygame').quizyMemoryGame(args); and then call it like game.handleTimeout() but its not defined ... any idea how to access a nested function inside the init function?
The text was updated successfully, but these errors were encountered:
Sorry for my late response.
I prefer the way you started doing it the first time.
However there is something wrong with it. The argument 'optionsMethods' you are passing can be in this case either an object with parameters to an init function or key for the methods array. A don't see where you define the methods array. And this is where you should define your handleTimeOut function.
If you have something like this:
var methods = {
init : function(options) {
// with this one you simply init the quizy plugin
},
handleTimeout : function( ) {
// here comes the code for your extra method
}
};
// Then comes the
$.fn.quizyMemoryGame.......
.....................
And then you should be able to call the plugin like this:
$('#my-memorygame').quizyMemoryGame(args) //init function
$('#my-memorygame').quizyMemoryGame('handleTimeout') // calls your function.
hi,
i wanted to combine the game with an countdown,so i have added the https://github.com/wimbarelds/TimeCircles Countdown which works fine. Now i'd like to add a
handleTimeout()
function in the plugin init function and call it like from the countdown callback. i changed the initialisation toto get a init function reference in the html page and do something like
var game = $('#my-memorygame').quizyMemoryGame(args);
and then call it likegame.handleTimeout()
but its not defined ... any idea how to access a nested function inside the init function?The text was updated successfully, but these errors were encountered: