我有一份有150行的清单,每行有3个有皮肤的选定项目。
由于在显示每个结果之前要完成繁忙的处理程序, 我有一个错误 : “ 此页面的脚本可能很忙, 或者它可能停止响应 。 您可以现在停止脚本, 或者继续看脚本是否完成 。 ” 并且它指的是 jquery. js 文件 。
能否通过做一些jQuery的工作来避免这一错误?
谢谢
我有一份有150行的清单,每行有3个有皮肤的选定项目。
由于在显示每个结果之前要完成繁忙的处理程序, 我有一个错误 : “ 此页面的脚本可能很忙, 或者它可能停止响应 。 您可以现在停止脚本, 或者继续看脚本是否完成 。 ” 并且它指的是 jquery. js 文件 。
能否通过做一些jQuery的工作来避免这一错误?
谢谢
您需要将处理过程分成多个部件, 并使用 0 或 1 msec 设置时间让浏览器有时间使用 < em> do stuff < / em> 。
使用
async.forEachSeries(yourData, function(item, cb) {
// process item
async.nextTick(cb);
});
yourData
可以是包含您行的 jQuery 对象,然后是 项
将是一行的 DOM 元素。
我不知道jQuery的情况(如果在jQuery里有包装纸的话),但在Vanilla JS中,也有WebWorkers的概念(除了IE以外,支持相当不错——见
在此您启动额外的线索到您的计算, 这不会阻断您的 UI 线索。 当计算完成, 只留下结果显示时, 您会将工人的数据发送到 UI 线索中, 只需显示结果 。
详情请查看MDN 辅导 。
网站表演大师Steve Souders在他的书“甚至更快的网站”中写了这个问题以及如何解决这个问题。他描述了一种解决办法,即你利用超时时间让其他进程也得到一些时间。
< a href=" "http://books.google.nl/books? id=E7p- 07kNfXYC&pg=PA102 & amp;lpg=PA102&dq=aeve% 20long% 20 transad% 20dress% 20souters & amp;source=bl&ots=UMenRKgdRp&sig=bGLyeFZyLD9NbUpXbNgGou8&hl=nlamp;sa=Xamp;ei=kKK8T7mgAqbB0XPO5B&ved=0CFYQAwAw=onepage&q&f=false"nolf" > heres the book 处理此问题的部分。
Download JavaScript as and when required, instead of downloading it all on page load.
< a href=> "http://ajaaxpatternes.org/On-Demand_Javascript" rel = “ no follow" > 需要 JavaScript
The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.
I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...
Ok, I m stumped. Basically, this script works fine in FF, but not in IE (6,7 or 8) - in which it returns an "Object doesn t support this property or method" error. Any ideas?: function ...
What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...