The fullscreen view in Safari on IOS 15 isn't being triggered when JavaScript is used to deploy a scroll down effect. This fullscreen view only seems to show when the screen is physically swiped up a little.
Is there a way this swipe up gesture can be triggered artificially with JavaScript to push the address bar down in a working example?
live site: https://user-railcoil.github.io/so/scroll/index.html
let
topButton = document.querySelector( '.top' ),
bottomButton = document.querySelector( '.bottom' );
window.scroll({
top: 2500,
left: 0,
behavior: 'smooth'
});
window.scrollBy({
top: 0,
left: 0,
behavior: 'smooth'
});
function scrollToBottom() {
bottomButton.scrollIntoView({
behavior: 'smooth'
});
}
function scrollToTop() {
topButton.scrollIntoView({
behavior: 'smooth'
});
}
topButton
.addEventListener( 'click', scrollToBottom );
bottomButton
.addEventListener( 'click', scrollToTop );
html, body {
margin: 0; padding: 0;
background-color: #222;
font-family: Arial;
text-align: center;
}
body {
filter: brightness( 105% );
}
main {
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: #eee;
}
button {
cursor: pointer;
border: none;
padding: 3rem;
background-color: #ddd;
color: #222;
font-size: 1rem;
filter: brightness( 102% );
}
button:hover, footer:hover {
background-color: #0cc; color: #eee;
}
button:active, footer:active {
background-color: #222; color: #222;
}
span {
opacity: 0.5;
}
<!DOCTYPE html>
<html lang='en-US'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<link rel='stylesheet' href='css/base.css'>
<style>
* { box-sizing: border-box; outline: none; }
div {
opacity: 0.125; font-size: 2rem;
line-height: 4rem;
letter-spacing: 0.25rem;
}
.bottom {
background-color: #222; color: #eee;
}
</style>
</head>
<body>
<main>
<button class='top'>
scroll to bottom <span>( click / tap )</span>
</button>
<div>
<p>click<p> <p>or</p> <p>tap</p> <p>the</p> <p>button</p>
<p>above</p> <p>to</p> <p>scroll</p> <p>all</p> <p>the</p>
<p>way</p> <p>to</p> <p>the</p> <p>bottom</p>
</div>
<button class='bottom'>scroll to top</button>
</main>
<script src='js/origin.js'></script>
</body>
</html>
These older solutions to older questions do not seem to work on these later versions of IOS ( 15+ )
How do I hide the address bar on iPhone?