简体   繁体   中英

Setting property in .css() in jquery

Hello guys probably i'm having a problem on setting property

transform: rotate(30deg) 

in my selector

$('.box1').css('left', x); 

I dont know where to add this line, can I put a variable in degrees? Thanks guys. I hope you can help me out fixing this.

Simply:

$('.box1').css({
    left: x,
    transform: 'rotate(30deg)'
});

Or:

$('.box1').css('left', x).css('transform', 'rotate(30deg)');

JSFiddle demo .

用这个

$('.box1').css('left', x).css('transform', 'rotate(30deg)')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM