Google Chrome 在页面上附加 ajax 内容时滚动冻结
Google Chrome scroll freezing while appending ajax content on a page
我的 chrome 滚动条有问题,在 Mozilla 上没有这样的问题。
我有几个同步 ajax 请求,然后在页面上附加了一些信息,他们需要大约 2 秒到 load.During 这次滚动条冻结并且不可用,当 ajax 结束时滚动效果很好。
当你使用同步 AJAX 页面停止直到 ajax 完成,所以如果你想让页面不停止,必须异步 AJAX 调用。
You can see more here:
Documentation AJAX W3Schools
您描述的问题不是浏览器行为问题。
当您发出同步请求时,这意味着等待响应的代码。
由于 javascript 是一种单线程语言(现在让我们忽略网络工作者),
UI processing/manipulation 也待处理,
这就是为什么浏览器或滚动条 "stuck".
它在 Firefox 上运行的原因是同步调用已被弃用(顺便说一句,因为 "stuck" 行为),而你在那里实际做的是异步请求;
您可以在这里阅读更多相关信息:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests
Javascript is completely single-threaded.
If you make multiple AJAX calls, you will receive each response as
soon as the server sends it; the order depends on the amount of time
that it takes the server to send each reply.
If your code is still running when the server replies, the reply will
only be processed after your code finishes.
You should try to load all of the data in a single request.
来源:SLaks
我可能会在这里碰壁,在其他编程语言中,您可以像这样为 connections/things 启动一个新线程,如果您 运行 多线程(有点像层),您的界面将保持不变它 is/was.
我的 chrome 滚动条有问题,在 Mozilla 上没有这样的问题。 我有几个同步 ajax 请求,然后在页面上附加了一些信息,他们需要大约 2 秒到 load.During 这次滚动条冻结并且不可用,当 ajax 结束时滚动效果很好。
当你使用同步 AJAX 页面停止直到 ajax 完成,所以如果你想让页面不停止,必须异步 AJAX 调用。
You can see more here: Documentation AJAX W3Schools
您描述的问题不是浏览器行为问题。
当您发出同步请求时,这意味着等待响应的代码。 由于 javascript 是一种单线程语言(现在让我们忽略网络工作者), UI processing/manipulation 也待处理, 这就是为什么浏览器或滚动条 "stuck".
它在 Firefox 上运行的原因是同步调用已被弃用(顺便说一句,因为 "stuck" 行为),而你在那里实际做的是异步请求; 您可以在这里阅读更多相关信息:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests
Javascript is completely single-threaded.
If you make multiple AJAX calls, you will receive each response as soon as the server sends it; the order depends on the amount of time that it takes the server to send each reply.
If your code is still running when the server replies, the reply will only be processed after your code finishes.
You should try to load all of the data in a single request.
来源:SLaks
我可能会在这里碰壁,在其他编程语言中,您可以像这样为 connections/things 启动一个新线程,如果您 运行 多线程(有点像层),您的界面将保持不变它 is/was.