My problem is the following one I want to change the right and the left of a css from a javascript but from a resolution 1920 here is my code.
var es_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
var mediaquery = window.matchMedia("(max-media: 1920px)")
if (es_safari) {
if (mediaquery.matches) {
document.getElementsByClassName('.box-emergent-right').style.right = "38.100%";
document.getElementsByClassName('.box-emergent').style.left = "38.100%";
}
}
.box-emergent {
left: 20%;
background: red;
position: relative;
width: 400px;
height: 200px;
border: 3px solid green;
}
.box-emergent-right {
right: 70%;
background: yellow;
}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Prueba javascript</title>
<link rel="stylesheet" href="">
</head>
<body>
<div class="box-emergent">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea nam explicabo hic animi culpa debitis, odio ipsa excepturi quidem facilis, fugiat, cupiditate provident a porro. Ipsam, totam, obcaecati. Laudantium, quibusdam.</p>
</div>
<div class="box-emergent-right">
</div>
</body>
First right image well rendered from chrome.
The Second Image may notice that since ipad does not revert well.