'jQuery scrollTop not working inside iframe on Iphone
This works everywhere, except for iframe on iOS.
the example is as
when you click on a category it should scroll , only I have the problem that it doesn't work on IOS
https://codepen.io/fdemian/full/ZjpXBe
I used
$('html, body').animate({ scrollTop: offsetTop }, 0);
Solution 1:[1]
You have to animate $("body") and not $("html, body") because the mobile ios doesn’t know it
Solution 2:[2]
I testesd it again. Seeing other solutions, the following function worked for me:
- for smartphone (apple, android)
window.scrollTo(x, y)
- for pc
$('html,body').animate({scrollTop: x, scrollLeft: y}, milliseconds)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | OiramDEV |
| Solution 2 | OiramDEV |
