Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to omit opacity changes from jQuery show()

I want to use the jQuery show(700) function, but I do not want any opacity changes. The element in question has a background PNG image with alpha transparency, and the opacity change causes strange black borders around the background image during the animation. How can I omit opactiy animation from the show() function?

like image 305
Josh Stodola Avatar asked Dec 06 '25 18:12

Josh Stodola


1 Answers

Use the animate function and simply vary the width and height. Here's a plugin that will do a reveal.

jQuery.fn.extend( {
    reveal: function() {
       return this.each( function() {
           var $this = $(this);
           $this.animate( { width: "show", height: "show" } );
       });
    }
}
like image 93
tvanfosson Avatar answered Dec 08 '25 11:12

tvanfosson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!