如何使用jQuery将css转换添加到当前转换值? [英] How to add css transform to the current transform value Using jquery?
本文介绍了如何使用jQuery将css转换添加到当前转换值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,我有一个当警报
$(".div-1").css("transform")
它给出矩阵值.
<style>
.div-1{
transform: rotate(57deg);
}
</style>
<div class="div-1">Test</div>
我需要使用以下命令将
scale(-1, 1)
添加到现有的转换值 jQuery
I need to add
scale(-1, 1)
to the existing transform value using Jquery
.因此.div-1转换值成为div-1 { transform: scale(-1, 1) rotate(57deg); }
怎么办?这里57只是一个数字,它将一直变化.所以我需要在当前转换值中添加scale( -1 , 1)
.请帮忙.
. so .div-1 transform value become div-1 { transform: scale(-1, 1) rotate(57deg); }
How to do this ? Here 57 is just a number , it will change always. so what I need is add scale( -1 , 1)
to the current transform value . Please help .
推荐答案
您可以执行以下操作:
var css = $('.div-1').css("transform");
css = css+" scale(-1,1)";
$('.div-1').css('transform',css);
这篇关于如何使用jQuery将css转换添加到当前转换值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文