Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support css order change #229

Open
RelicOfTesla opened this issue Jun 11, 2015 · 1 comment
Open

support css order change #229

RelicOfTesla opened this issue Jun 11, 2015 · 1 comment

Comments

@RelicOfTesla
Copy link

im css(rotate) at any remote place.
when i will change x,y on after...
it's bad position todo.

.xx{ transform : translate(50px,0px) rotate(60deg); }
.xx{ transform : rotate(60deg)  translate(50px,0px);  }

it's different result with position .

@RelicOfTesla
Copy link
Author

function any_function(obj){
// .......
obj.css({rotate : 60});
// .......
}

//... any place ....
var target = $('.xxx');
///.............
any_function(target);
//.............


//// NOW, I WILL set position...but this object has rotate css, I can't set it. the 

// Target.css({ x: 100, y:100 }); // is bad position..

// SO:
    // sort css [BEGIN]
    var raw = target.css('transit:transform');
    if (raw) {
        var bak = new Array();
        for (var k in raw) {
            if (raw.hasOwnProperty(k)) {
                bak.push({
                    key: k,
                    value: raw[k]
                });
            }
        }
        for (var i = 0; i < bak.length; ++i) {
            delete raw[bak[i].key];
        }
        raw.set('translate', 0, 0);
        for (var i = 0; i < bak.length; ++i) {
            raw[bak[i].key] = bak[i].value;
        }
        target.css('transit:transform', raw);

    }
    // sort css [END]

Target.css({ x: 100, y:100 }); // IS RIGHT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant