I haven't writen a plugn that does this but something like:

$.fn.addFeedback = function(feedbackMessage, callback ){

...

if(jQuery.isFunction(callback)
  callback.apply($(this));

??

Someone with better plugin-fu could probably tell me how that's all wrong.
Also, you might need to deal with timing issues if you want to make sure the
callback is run only after the animations / setTimeout complete.

Scott

On Feb 5, 2008 10:35 AM, Dan Eastwell <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I have the following function:
>
> // Show and fade out a feedback message
> $.fn.addFeedback = function(feedbackMessage){
>         var offset = $(this).offset();
>         var feedbackDiv = "<div class='feedback' id='feedbackElement'
> style='display:none;position:absolute;left:" + offset.left  + "px;top:" +
> (offset.top + 0)  +"px'><p>" + feedbackMessage + "</p></div>";
>         $("body").append(feedbackDiv);
>         $('#feedbackElement').fadeIn('slow');
>         setTimeout("$('#feedbackElement').fadeOut('slow',
> function(){$('#feedbackElement').remove();});",3000);
> }
>
> How do I change this to add an optional callback function to operate once
> the function has completed?
>
> Thanks,
>
> Dan.
>
>
> --
> Daniel Eastwell
>
> Portfolio and articles:
> http://www.thoughtballoon.co.uk
>
> Blog:
> http://www.thoughtballoon.co.uk/blog




-- 
--
Scott Trudeau
scott.trudeau AT gmail DOT com
http://sstrudeau.com/
AIM: sodthestreets

Reply via email to