Bug Tracker

Modify

Ticket #5953 (closed bug: worksforme)

Opened 3 years ago

Last modified 15 months ago

specialEasing in animate

Reported by: Axdr Owned by:
Priority: low Milestone: 1.4.2
Component: effects Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

If you're trying to animate font size using special per-property easing it won't work. For example:

$("span").animate({font-size:'2em'}, {duration: 1000, specialEasing: {'font-size': 'special'}});

A conflict is between

  • - 5328 var name = p.replace(rdashAlpha, fcamelCase);

and

  • - 5618 var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];

this.prop will be 'fontSize' instead of 'font-size' but 'fontSize' is not a CSS name. This will work:

$("span").animate({font-size:'2em'}, {duration: 1000, specialEasing: {'fontSize': 'special'}});

Sorry for my awful english.

Attachments

ticket.txt Download (732 bytes) - added by Axdr 3 years ago.

Change History

Changed 3 years ago by Axdr

comment:1 Changed 3 years ago by Axdr

sorry $("span").animate({font-size:'2em'}, {duration: 1000, specialEasing: {'fontSize': 'special'}}); this won't work also

comment:2 Changed 3 years ago by Axdr

I use this:

  • 5618
      var altName = this.prop.replace(
    	    /([a-z])([A-Z])/g, 
    	    function(s,b1,b2){return b1 + "-" + b2.toLowerCase()}
    	);
    	var specialEasing = 
              this.options.specialEasing && 
                (this.options.specialEasing[this.prop] ||  
                 this.options.specialEasing[altName]
    	    );
    

comment:3 Changed 3 years ago by Axdr

This is better solution.

  • line 5330
        if ( p !== name ) {
            prop[ name ] = prop[ p ];
            delete prop[ p ]; 
            p = name;
        }
    

must be changed

    if ( p !== name ) {
        if (opt.specialEasing && opt.specialEasing[p]) {
            opt.specialEasing[name] = opt.specialEasing[p];
            delete opt.specialEasing[p];
        }
        prop[ name ] = prop[ p ];
        delete prop[ p ]; 
        p = name;
    }

The line 5618 rests unaffected.

comment:4 Changed 3 years ago by dmethvin

  • Component changed from unfiled to fx

comment:5 Changed 3 years ago by jitter

  • Priority changed from major to low
  • Status changed from new to closed
  • Resolution set to worksforme

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a testcase!

Your test case contained a syntax error and there is no easing called "special". After fixing these in your test code I uploaded a reconstructed version of your test case here  test case.

This works just fine for me with no errors and the text animated.

If you feel this ticket was incorrectly closed or the bug still persists for you, feel free to report back with a reproducible test case and reopen the issue.

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.