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?
views:
196answers:
3
+1
A:
I just found it. Search for the genFx
function in jQuery. You see it loops through arrays of styles and returns an object of the right styles, which eventually gets passed to the animate
function internally. Just remove "opacity" from the array!
This also might work for you...
.animate({ width: "show" });
Josh Stodola
2009-11-29 22:00:15
+3
A:
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" } );
});
}
}
tvanfosson
2009-11-29 22:08:28
Thanks a lot, Tim!!
Josh Stodola
2009-11-30 14:20:46
A:
jQuery's show slowly (show with a duration) does a slidedown and a fadein simultaneously. If all you want is the slidedown, just use the slidedown.
jQuery("#someElement").slideDown(700);
Not much more to say about that.
darkporter
2009-11-29 22:13:43
Yeah, camel case, I updated my answer. And I forgot that show(milliseconds) does a fadein, a slidedown _and_ and slide "out". In that case @tvanfosson's answer looks best.
darkporter
2009-11-29 22:33:00
`slideDown` only animates the height, I primarily would like to animate the width. My answer is working, and so is tvanfosson's. Thanks for the help.
Josh Stodola
2009-11-30 14:19:50