Landing animation of scrollLeft/scrollTop (also works on random DOM object properties as well).
This commit is contained in:
parent
557ec9a92f
commit
97f2032e13
1 changed files with 7 additions and 11 deletions
16
src/fx/fx.js
16
src/fx/fx.js
|
@ -424,18 +424,10 @@ jQuery.extend({
|
||||||
|
|
||||||
timers: [],
|
timers: [],
|
||||||
|
|
||||||
/*
|
|
||||||
* I originally wrote fx() as a clone of moo.fx and in the process
|
|
||||||
* of making it small in size the code became illegible to sane
|
|
||||||
* people. You've been warned.
|
|
||||||
*/
|
|
||||||
|
|
||||||
fx: function( elem, options, prop ){
|
fx: function( elem, options, prop ){
|
||||||
|
|
||||||
var z = this;
|
var z = this, y = elem.style,
|
||||||
|
isprop = elem[prop] != null && y[prop] == null;
|
||||||
// The styles
|
|
||||||
var y = elem.style;
|
|
||||||
|
|
||||||
// Simple function for setting a style value
|
// Simple function for setting a style value
|
||||||
z.a = function(){
|
z.a = function(){
|
||||||
|
@ -445,6 +437,9 @@ jQuery.extend({
|
||||||
if ( prop == "opacity" )
|
if ( prop == "opacity" )
|
||||||
jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
|
jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
|
||||||
else {
|
else {
|
||||||
|
if ( isprop )
|
||||||
|
elem[prop] = parseInt(z.now);
|
||||||
|
else
|
||||||
y[prop] = parseInt(z.now) + "px";
|
y[prop] = parseInt(z.now) + "px";
|
||||||
|
|
||||||
// Set display property to block for height/width animations
|
// Set display property to block for height/width animations
|
||||||
|
@ -460,6 +455,7 @@ jQuery.extend({
|
||||||
|
|
||||||
// Get the current size
|
// Get the current size
|
||||||
z.cur = function(){
|
z.cur = function(){
|
||||||
|
if ( isprop ) return elem[prop];
|
||||||
var r = parseFloat( jQuery.curCSS(elem, prop) );
|
var r = parseFloat( jQuery.curCSS(elem, prop) );
|
||||||
return r && r > -10000 ? r : z.max();
|
return r && r > -10000 ? r : z.max();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue