colmtuite colmtuite - 1 year ago 129
Javascript Question

Get CSS transform property with jQuery

I'm trying to get the

-webkit-transform: translateY('')
property in a variable.


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


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

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

Answer Source
$('.foo').click(function() {
    var current_pull = parseInt($('.form-con').css('transform').split(',')[5]);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download