So I’m using http://keith-wood.name/countdown.html to do a countdown and am trying to figure out how to pass some params to the callback function that can be set in the plugins’ options:
var param = 5;
initCount(param);
function initCount(param) {
$('selector').countdown({
onExpiry:
function endCount(param) {
alert(param);
}
});
}
I took a look at the full version of jquery.countdown.js and found the developer literally saying this on Line 47 and Line 48: “// receives no parameters and ‘this’ is the containing division” Well, that’s not good enough for me. Applying his options, he uses the following code: (Line 209)
var onExpiry = this._get(inst, ‘onExpiry’);
if (onExpiry) {
onExpiry.apply(target, []);
}
So…. What would be the best way to change:
onExpiry.apply(target, [])
So that I could pass my params if needed in the options as proposed above?
Thoughts?
i have encoutered the very same probleme , thanks god i just found a round about solution here it is :
you have to add a new parameter to the signature of options in Jquery.countdown.js :
then you should add your identifier the call of the function
then the call to your UpdateCountdown will look like this
your function will look like this one :
you can potentialy turn alwaysExpire on the Jquery.countdown.js to true , so you can test pre-expired dates .