ScrollTop not working in Chrome/Safari

后端 未结 1 380
Happy的楠姐
Happy的楠姐 2021-01-23 06:48

I have a form within a loop on our site and when someone submits the form then a query string is added to the url something like \"?updated=111\". Then my JQuery script checks

1条回答
  •  花落未央
    2021-01-23 07:04

    Try putting the ".animate()" method inside a timeout of 2seconds. Does the problem go away? If it does, then its timing issue. Most likely thats because the browser is not ready to scroll to the location that you ask it to scroll to.

    In this situation, you'd rather go with a timeout of 0 than a 2 sec. A 0 timeout just schedules the scroll for next cycle whenever the browser is free.

    HTH!

    0 讨论(0)
提交回复
热议问题