I am facing an issue with a div that has CSS properties display: flex
and position:fixed;
. I am trying to scroll to the top of it. This functionality is working fine on all platforms except for iOS mobile devices. The scrolling does not work on iOS mobile devices in any browser.
Below is an example of the code:
function scrollToTop() {
document.getElementsByClassName('content-wrapper').scrollTop = 100;
};
.mobile{
/* CSS styles here */
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" onclick="scrollToTop()">
Scroll To Top
</button>
<body class="mobile">
<div class="page-wrapper">
<div class="page-content-wrapper">
<div class="content-wrapper">
<div class="session-wrapper-mobile play-session-mobile">
<!-- Content goes here -->
</div>
</div>
</div>
</div>
</body>