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

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -