javascript - jquery css right on iOS -
i tried position of element right. defined following in css
.container { position: absolute; right: 8%; bottom: 7%; }
i tried position of element right using following jquery code
$('.container').css('right');
which gives 142px on chrome , mozilla
but gives 8 (percentage) on ios(both safari , chrome) browsers.
any other options in jquery value in px on ios browsers , other browsers alike?
take percentage , value...
var px_right = ('.container').css('right'); /* --- --- */ if ( /*ios*/ navigator.useragent.match(/(ipod|iphone|ipad)/)) { px_right = (('.container').css('right'))/100.0 * window.width(); }
`
edit sorry have forgotten thing: /100.0
. edited:
px_right = (('.container').css('right'))/100.0 * window.width();
example : 'px_right = 8% of 980px = 0.08*980 = 78px
Comments
Post a Comment