Thanks, Scott,

You're right, I'll have a look at this - I'm still really something of a
beginner here! And you're right about the timing, too, I'd want the callback
function to only start when the animation ends, or better, when it's about
to end, so any transition is fairly seamless.

I guess I also need to make it fairly robust in case there is more than one
instance of the feedback panel on the page at any one time - 3 seconds is
enough time to invoke several...!

Thanks,

Dan.

On 2/5/08, Scott Trudeau <[EMAIL PROTECTED]> wrote:
>
>
> 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




-- 
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

Reply via email to