Ok, in the meanwhile i found the plugin documentation (sitting right on the 
homepage, i must had a fit of blindness :)) so i just have to do it as an 
additional option. Thanks a lot for the clear explanation renato ! I know this 
sounded like a stupid question, but i'm just not feeling at home with 
javascript.  Although with jquery, i already feel in my county :)

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Renato 
Formato
Sent: lundi 14 mai 2007 16:39
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: callback in a plugin


Alexandre Plennevaux ha scritto:
>  
> i would like to add this to the jqUploader plugin, so that i could do 
> something like:
>  
>  
> function pleaseDoTheseThings (params){
>     $("#dothis").show();
> }
>  
> $("input#example1").jqUploader({ 
>         background:     "FF9900", 
>         barColor:       "FFDD00", 
>         allowedExt:     "gif",
>         callBack: pleaseDoTheseThings 
>     }); 
>  
>  
> Thanks a lot!
>  
> Alexandre
> 

The principle is quite simple.

When the plugin has completed its processing, and it is up to the 
plugin's author to know when it has, you just call your callback 
function if setted in the options.

Something like this:

var options = {callback:function(){alert("I've finished!");}}
jQuery.fn.my_plugin_with_callback = function(options) {
  this.each(function(){
        ...do some processing
  });
  if(options.callback) callback();
}

Renato

Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.467 / Base de données virus: 269.7.0/803 - Date: 13/05/2007 12:17
 

Reply via email to