Jquery extract values ββfrom css
How to extract a style property
<div id="clipProperty" style="clip: rect(0px 281px 647px 0px);"></div>
and add it to # getClipVaalues ββwith 30 subtracted from the second value 281, so it says clip: rect (0px 251px 647px 0px)?
<div id="getClipValues"></div>
This is my js code
var clipProperty = $('#clipProperty').attr('style');
$('#getClipValues').attr('style', clipProperty);
The clipProperty property is not constant, but changes regularly. But I always need to subtract 30 from the second value.
+3
source to share
2 answers
You are looking for something like this:
var clip = $('#clipProperty').attr('style');
var clip2 = $('#getClipValues').css('clip', 'rect(0px 231px 647px 0px');
I did a little jsFiddle with it to get the result: http://jsfiddle.net/jtu5y1te/1/
0
source to share