Bug Tracker

Modify

Ticket #4660 (closed enhancement: worksforme)

Opened 4 years ago

Last modified 20 months ago

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:
Blocking: Blocked by:

Description (last modified by ajpiano) (diff)

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

comment:2 Changed 4 years ago by mofle

This should really be fixed for 1.4.

comment:20 Changed 3 years ago by mattlunn

Wow... 10 months. This is old, tiring, and not very clean!

1.4 was out looooong ago :(

comment:21 Changed 3 years ago by SlexAxton

  • Priority changed from minor to low
  • Status changed from new to open
  • Milestone changed from 1.4 to 1.5

comment:22 Changed 2 years ago by john

  • Milestone set to 1.next

We should look at fixing this properly in 1.7.

comment:23 Changed 2 years ago by john

  • Keywords fade,fadeOut,hide,fadeTo,1.7-discuss added; fade, fadeOut, hide, fadeTo removed

Nominating ticket for 1.7 discussion.

comment:24 Changed 2 years ago by dmethvin

+1, Seems like .fadeTo() should show hidden elements, shouldn't have back-compat issues.

comment:25 Changed 2 years ago by rwaldron

  • Description modified (diff)

+1, Seems obvious

comment:26 Changed 2 years ago by jaubourg

+1, Looks like a bug to me.

comment:27 Changed 2 years ago by ajpiano

  • Description modified (diff)

+1,

comment:28 Changed 2 years ago by timmywil

  • Description modified (diff)

+1,

comment:29 Changed 2 years ago by danheberden

+1

comment:30 Changed 2 years ago by john

+1, Seems like we could just make sure it's visible before animating.

comment:31 Changed 2 years ago by scott.gonzalez

+1

comment:32 Changed 2 years ago by addyosmani

+1

comment:33 Changed 2 years ago by jzaefferer

+1

comment:34 Changed 2 years ago by cowboy

+1

comment:35 Changed 23 months ago by ajpiano

  • Description modified (diff)
  • Milestone changed from 1.next to 1.7

comment:36 Changed 22 months ago by gnarf

  • Owner set to gnarf
  • Status changed from open to assigned

comment:37 Changed 20 months ago by timmywil

  • Owner changed from gnarf to timmywil

picking this one up

comment:38 Changed 20 months ago by timmywil

  • Status changed from assigned to closed
  • Resolution set to worksforme

Looks like this is already fixed.  http://jsfiddle.net/timmywil/cdrYt/

Let's always have test cases in tickets. ;)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.