Opened 11 years ago
Closed 11 years ago
#10229 closed enhancement (wontfix)
Relative value syntax (for .css() and .animate()) should support more mathematical operations
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | css | Version: | 1.6.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
Right now, you can set a css property relative to a current value. However, I think jQuery ought to support multiplication and division as well.
Use-cases for this vary, in my case, I want to set the scale (3d/2d transformation) relative to its current position, but scale is a multiplier, not a static value; You don't "add one" to a scale, you "multiply by 1.01".
Another use-case is when someone wants to double/triple the current value, same with halving, dividing, etc.
From my casual peek at the code, it seems like this would involve small changes to the rrelNum
regex in css.js and some corresponding changes to the style() method.
Change History (11)
comment:1 Changed 11 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
Status: | new → open |
comment:3 Changed 11 years ago by
Keywords: | 1.8-discuss added |
---|
I'm not a fan but will put it up for discussion.
comment:4 Changed 11 years ago by
-1.
You can easily do this already:
$("div").css("margin", function( i, val ) { return val * 0.666; });
If we do this, expect requests for even more advanced math :P
$("div").css("margin", "(sqrt(cos(x))*cos(200*x)+sqrt(abs(x))-0.7)*(4-x*x)^0.01,sqrt(9-x^2),-sqrt(9-x^2)");
comment:10 Changed 11 years ago by
Description: | modified (diff) |
---|
-1, Give an inch and they'll take a mile. Feature creep
comment:11 Changed 11 years ago by
Keywords: | 1.8-discuss removed |
---|---|
Resolution: | → wontfix |
Status: | open → closed |
Voted off the island.
Opening up for discussion/voting. imo, this can be achieved with custom workarounds, but I'll see what others have to say about it.