Firefox scrollTop problem

前端 未结 5 961
感动是毒
感动是毒 2021-01-22 10:34

I have a problem with Firefox scrollTop value and onscroll event. This works great in IE, Safari and Chrome but Firefox seems to lag.

I tried to update some background p

5条回答
  •  甜味超标
    2021-01-22 11:18

    Wouldn't the behavior of dragging the window up and down quickly be considered abnormal?

    In my view, I wouldn't want to be saving the state if the user is doing that. I'd rather wait until the window has been in the same spot for at least 250ms before recording it's position. The minor variances in position while the user is slamming the scrollbar up and down are probably not very important to the user, know what I mean?

    With a little setTimeout magic, couldn't you sidestep this issue AND make your script a little lighter on the browser UI by not firing the SaveScrollLocation until it clear the scroll location is WORTH saving?

提交回复
热议问题