Opened 14 years ago
Closed 11 years ago
#4660 closed enhancement (worksforme)
fadeTo() does not fade-in elements after hide() or fadeOut() is called on them
Reported by: | zachstronaut | Owned by: | timmywil |
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | effects | Version: | 1.3.2 |
Keywords: | fade, fadeOut, hide, fadeTo, 1.7-discuss | Cc: | |
Blocked by: | Blocking: |
Description (last modified by )
If you call $('#foo').hide() or $('#foo).fadeOut() then calling $('#foo').fadeTo(1000, 0.5) will NOT fade the element back in to 50% opacity.
You must do $('#foo').css('opacity', 0).show().fadeTo(1000, 0.5) which gets kind of old.
The fadeTo() method could be patched to do this on its own:
(function ($) {
var proxied = $.fn.fadeTo; $.fn.fadeTo = function() {
if ($(this).is(':hidden')) {
$(this).css('opacity', 0).show();
}
return proxied.apply(this, arguments);
}
})(jQuery);
Rather than proxy patching fadeTo() it would be nice if the method itself were patched in the jQuery library code.
Change History (20)
comment:2 Changed 13 years ago by
comment:20 Changed 13 years ago by
Wow... 10 months. This is old, tiring, and not very clean!
1.4 was out looooong ago :(
comment:21 Changed 12 years ago by
Milestone: | 1.4 → 1.5 |
---|---|
Priority: | minor → low |
Status: | new → open |
comment:22 Changed 12 years ago by
Milestone: | → 1.next |
---|
We should look at fixing this properly in 1.7.
comment:23 Changed 12 years ago by
Keywords: | 1.7-discuss added |
---|
Nominating ticket for 1.7 discussion.
comment:24 Changed 12 years ago by
+1, Seems like .fadeTo()
should show hidden elements, shouldn't have back-compat issues.
comment:30 Changed 12 years ago by
+1, Seems like we could just make sure it's visible before animating.
comment:35 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Milestone: | 1.next → 1.7 |
comment:36 Changed 11 years ago by
Owner: | set to gnarf |
---|---|
Status: | open → assigned |
comment:38 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
Looks like this is already fixed. http://jsfiddle.net/timmywil/cdrYt/
Let's always have test cases in tickets. ;)
This should really be fixed for 1.4.