Bug Tracker

Ticket #7345 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

Support relative values for $().css()

Reported by: brandon Owned by: danheberden
Priority: low Milestone: 1.6
Component: css Version: 1.4.3
Keywords: relative css Cc:
Blocking: Blocked by:

Description

Pulled from:  http://github.com/paulirish/lazyweb-requests/issues/issue/10

Relative values are usable in jQuery.fn.animate, why not jQuery.fn.css? Help me stop using this work around:

$('elem').animate({ 'left' : '+=10px' }, 0);

Attachments

7345.patch Download (1.9 KB) - added by brandon 4 years ago.
Patch + tests

Change History

comment:1 Changed 4 years ago by brandon

  • Priority changed from undecided to low
  • Component changed from unfiled to css

Changed 4 years ago by brandon

Patch + tests

comment:2 Changed 4 years ago by brandon

Added patch to github with pull request:  http://github.com/jquery/jquery/pull/78

comment:3 Changed 4 years ago by SlexAxton

  • Keywords relative css added
  • Priority changed from low to high
  • Status changed from new to open

As far as enhancements go, I think this is a great one. Thanks for the pull request.

comment:4 Changed 4 years ago by dmethvin

  • Priority changed from high to low

comment:5 Changed 4 years ago by snover

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

comment:6 Changed 4 years ago by paul.irish

I keep thinking this is already in. snov, can you land this?

comment:7 Changed 4 years ago by paul.irish

snover is interested in seeing this patch done a bit more DRY. have to generalize the effect.js aspect of this to share between the two.  https://github.com/jquery/jquery/pull/78

anyone can feel free to tackle that. :)

comment:8 Changed 4 years ago by ajpiano

  • Owner changed from brandon to ajpiano

comment:9 Changed 4 years ago by ajpiano

  • Milestone set to 1.6

comment:10 Changed 4 years ago by ajpiano

  • Owner changed from ajpiano to danheberden

comment:11 Changed 4 years ago by dmethvin

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

comment:12 Changed 3 years ago by anonymous

not working here in 1.6.1 ...

comment:13 Changed 3 years ago by danheberden

Sorry you're having troubles - sounds like something else might be the problem though? Please provide a test case for the odd behaviour you're experiencing using jsfiddle.net

I made one:  http://jsfiddle.net/danheberden/tGNZm/

Since jsfiddle.net doesn't have 1.6.1 on the list, I just added it via the resources area:  https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js

Note: See TracTickets for help on using tickets.