Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#5953 closed bug (worksforme)

specialEasing in animate

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

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 (1)

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

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by Axdr

Attachment: ticket.txt added

comment:1 Changed 10 years ago by Axdr

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

comment:2 Changed 10 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 10 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 9 years ago by dmethvin

Component: unfiledfx

comment:5 Changed 9 years ago by jitter

Priority: majorlow
Resolution: worksforme
Status: newclosed

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.

Note: See TracTickets for help on using tickets.