I have made a jQuery plugin which makes a splash screen. It uses the animate function of jQuery and is initalized and fired by the following:
$('#temperature_splash').splashScreen();
$('.tempGraphButton').click(function () {
$('#temperature_splash').splashScreen('splash', 300);
//Here, I would like to make an ajax request when the animation has finished
}
I would like to make an ajax request after the animations in the plugin has finished but I don’t know how. Does anyone have any suggestions?
Outline of the plugin code
$.fn.splashScreen = function (method) {
// Method calling logic
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist');
}
}
var methods = {
init: function () {
//Some initializations
},
splash: function (time) {
//Setting some properties
splashScreenContent.animate({
width: width,
left: leftPos
}, time).animate({
height: height,
top: topPos
}, time);
return false;
}
}
})(jQuery);
just add a callback
It’s just an example, you’ll have to figure out what options to pass and how to tie it into your plugin yourself.