使用jQuery获取CSS转换属性 [英] Get CSS transform property with jQuery

查看:141
本文介绍了使用jQuery获取CSS转换属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在变量中获取 -webkit-transform:translateY('')属性。

I'm trying to get the -webkit-transform: translateY('') property in a variable.

HTML

<form class="form-con" style="-webkit-transform: translateY(-802px);"></form>

JS

$('.foo').click(function() {
    var current_pull = parseInt($('.form-con').css('transform').split(',')[4]);
});

这是返回'0',而不是正确的值。

This is returning '0', instead of the correct value.

推荐答案

$('.foo').click(function() {
    var current_pull = parseInt($('.form-con').css('transform').split(',')[5]);
});

这篇关于使用jQuery获取CSS转换属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆