Jquery scrolltop and scrollleft work fine, but on iphone do they all scroll another bar to its home position?

I use the following jquery code to scroll vertically to a specific position on a page. This works absolutely normal in all browsers and does not affect the horizontal scroll position, however, when I try to use it on the iphone (mobile safari) in addition to scrolling to the right place vertically, it also scrolls horizontally to the left. Similarly, if I use scrollleft, it will go to the right place horizontally, but will return to the top of the page. It works great for everything else, and I can not find any link to this problem anywhere, I would be very grateful if anyone who comes across this can help me since I'm at a dead end! I can't even do one after the other (scrollleft then scrollright), since the one I do last cancels the scroll job,established by the previous.

if($.browser.opera)
{
    $('html').animate(
    {
        scrollTop: yscroll - 10
    }, 
    1000);
}
else
{
    $('html, body').animate(
    {
        scrollTop: yscroll - 10
    }, 
    1000);
}

!

Dave

+3
1

, scrollLeft ( scrollTop, scrollLeft), scrollLeft, scrollTop, iphone

var isiPhone = navigator.userAgent.toLowerCase().indexOf("iphone");
var isiPad = navigator.userAgent.toLowerCase().indexOf("ipad");
var isiPod = navigator.userAgent.toLowerCase().indexOf("ipod");

, ,

iphone/pad iPad/jQuery.animate()

0

Source: https://habr.com/ru/post/1788903/


All Articles