I've found some related cases but no answer works for me. My page have a big horizontal image but I need to start scrolling it from the middle (just horizontally), always and in any resolution.
var body = document.body; // For Safari
var html = document.documentElement; // Chrome, Firefox, IE and Opera
body.scrollLeft = (html.clientWidth - body.scrollWidth) / 2
html.scrollLeft = (html.clientWidth - body.scrollWidth) / 2
body {
background-color: 0178fa;
padding: 0;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
overflow: auto;
}
#page {
width: 100%;
height: 100%;
margin: 0 auto;
padding: 0;
display: block;
}
#wrap-landing {
position: relative;
margin: 0 auto;
padding: 0;
content: url(https://i.imgur.com/gb6EyHk.png);
width: 1920px;
height: 1080px;
}
<div id="page">
<div id="wrap-landing"></div>
</div>