jQuery.fn.extend({
        fade_in:function(speed,callback){
                return $(this).animate({opacity:0},speed,callback);
        },
        fade_out:function(speed,callback){
                return $(this).animate({opacity:1},speed,callback);
        },
        toggle_fade:function(speed,callback){
                return 
$(this).animate({opacity:(parseInt($(this).css("opacity"))
===0?1:0)},speed,callback);
        }
});

$("a.example").click(function(){
        // if it's a # element just remove the each and do $
("div#id").toggle_fade(300);
        $("div.element").each(function() {
                return toggle_fade(300);
        });
        return false;
});


On Apr 6, 6:00 pm, PF <piercefree...@gmail.com> wrote:
> Hi everyone:
>
> I am looking for a way using jQuery to fade my content in and out when
> the user clicks a button.  For example:
>
> The user loads the page, the content <div> fades in.
> The user clicks on a like to another page and the content fades out
> and then the new content fades in.
>
> And ideas?

Reply via email to