Tag: settimeout

setTimeout和jQuery:Uncaught RangeError:超出最大调用堆栈大小

我试图在页面加载时调用我的类,以及重新加载X秒的结果,但是在setTimeout教程之后,jquery似乎折腾了一个错误,我不明白它是无语法。 未捕获RangeError:超出最大调用堆栈大小 var rand = function() { return Math.random().toString(36).substr(2); }; lhc(); function lhc(){ $(‘#lhcb a’).each(function() { var rawlink = $(this).attr(“href”); var link = encodeURIComponent( rawlink ); var token = rand(); var href = $(this).prop(‘href’); var proceed = $.getJSON( “lhc/link.php?link=” + link + “&a=c”, function( data ) { if ( data.proceed == ‘true’ ) { return […]

为什么Progress Bar不会像Text一样动态变化?

我在setTimeout()函数后动态更新了一些元素。 jQuery函数.text()似乎在处理时随着数组索引的每次更改而动态更新。 但是通过.css()和.attr()更改的bootstrap进度条似乎没有动态更新。 这是我的页面: http : //imdbnator.com/process.php?id = f144caf0843490c0d3674113b03da0c5&redirect = false 您可以看到文本被更改但进度条仅在整个setTimeout()函数完成后才结束。 另外,如果我设置delay = 1000 。 有用。 但它因应用而变慢。 因此,我需要delay = 0 。 但为什么进度条不会改变? 这是我的片段 function launch(a) { var inc = 0; var maxc = a.length; var delay = 0; // delay milliseconds var iID = setInterval(function () { var index = inc; var movie = […]

jQuery:不常用火鼠移动事件

我试图找出一种简洁的方法来聚合mousemove事件,以便我确保我的代码被调用,但每250-300毫秒只能调用一次。 我曾考虑使用类似下面的内容,但想知道是否有更好的模式,或者jQuery提供的东西会做同样的事情: var mousemove_timeout = null; $(‘body’).mousemove(function() { if (mousemove_timeout == null) { mousemove_timeout = window.setTimeout(myFunction, 250); } }); function myFunction() { /* * Run my code… */ mousemove_timeout = null; } 编辑:下面接受的答案将完全适用于这种情况,但是,我发现答案中提供的mousestop()function实际上消除了我对聚合的需求,所以如果你正在阅读这个问题并寻找答案,请参阅如果mousestop插件是你真正需要的!

如何在“X”秒后进行jquery函数调用

我有一个jquery函数,我需要在Iframe中打开网站后调用它。 我想在iframe中打开一个weblink,打开它后我需要调用下面的函数。 那我该怎么做? 这是我的function: $(document).ready(function(){ $(“#”).click(function (event) { $(‘#’).change(function () { $(‘#various3’).attr(‘href’, $(this).val()); }); $(“#”).click(); }); }) function showStickySuccessToast() { $().toastmessage(‘showToast’, { text: ‘Finished Processing!’, sticky: false, position: ‘middle-center’, type: ‘success’, closeText: ”, close: function () { } }); } 这是我在IFrame中打开链接的按钮: 实际上这是我所拥有的简单页面: 这就是信息

为什么firebug说我的函数调用是“未定义的”

我有一个包含子菜单的导航菜单。 在hover时我希望子菜单在第二次延迟后显示。 标有“更多”类的菜单项包含子菜单。 问题是我的一个名为hoverCheck()的函数在被调用时会返回undefined。 但我无法弄清楚为什么。 这是我的代码: $(document).ready(function() { navigation(); }); function navigation() { var moreMenu = $(‘.nav li.more’); var hovering; function hoverCheck() { hovering = ‘hover’; openMenu(); } function openMenu() { if(hovering == ‘hover’) { $(this).children(‘ul’).slideDown(‘fast’); } } moreMenu.mouseenter(function() { setTimeout(“hoverCheck()”,1000); }); moreMenu.mouseleave(function() { hovering = null; $(this).children(‘ul’).slideUp(‘fast’); }); }

setTimeout到window.open并关闭,在同一个窗口上?

我在一段时间后打开窗户时遇到一些困难,然后在一段时间后自动关闭它们。 我不知道为什么,但似乎当我尝试在window.open和window.close上使用setTimeout时,它们会以某种方式干扰。 这是我的代码atm: function topLeft() { var myWindow = “image.png”, “ONE”, “width=300,height=310,top=100,left=100,menubar=no,toolbar=no,titlebar=no,statusbar=no”; setTimeout(function() { myWindow.window.open() }, 5000); setTimeout(function() { myWindow.close() }, 10000); function start() { openClose(); } window.onload = start; 谢谢你的期待

jQuery和setTimeout

我有以下代码: jQuery(document).ready(function() { setTimeout($(‘#loading’).fadeIn(‘slow’), 9999); }); 它应该在9999毫秒后慢慢淡入加载元件,但它会直接淡化它…为什么? 谁能帮忙。 谢谢

jQuery .each中setTimeout()的问题

以下代码无法正常运行。 我尝试了不同的变化和搜索,但没有运气。 i = 1; var timer = new Array(); jQuery(‘a’).each(function($) { i++; timer[i] = setTimeout(jQuery(this).remove(), i * 5000) })

SetTimeOut Timer中的JQuery GetJSON

任何人都可以发布一个示例代码,其中有一个正在运行的计时器(javascript settimeout)并进行数据检索。 基本上我的这个计时器做的是显示新消息.. myFunction(param){ //data retrieval operation //using getJSON.. call displaydata() base on param settimeout(“myFunction()”, param, 1000); } function displaydata(param){ //processing alert(‘test’)} 我应该使用getJSON吗? 我认为这是异步调用的问题..

循环使用.each延迟Jquery

我不擅长jQuery所以我不确定我的假设是否正确。 我正在使用同位素插件,我希望逐个插入元素(而不是一次性插入)稍微延迟,所以它看起来也像它(对于人眼) 插入我使用的同位素项目 $(‘#container’).isotope( ‘insert’, $item); 所以为了逐个插入我正在做的事情 $(“#items_are_here”).find(‘.item’).each(function( index ) { setTimeout(function() { $(‘#container’).isotope( ‘insert’, $(this)); },3000); }); 然而,这似乎是浏览器等待某些东西,然后立即显示它们 如果我做 setTimeout(function() { $(“#items_are_here”).find(‘.item’).each(function( index ) { $(‘#container’).isotope( ‘insert’, $(this)); }); },3000); 一切正常,但不是一个一个.. 这是正确的方法吗? 还是我过于复杂了? 这里是小提琴 。 在其中,有2个buttosn – 全部插入 – 它找到所有.item并插入它们。 并逐个插入,以延迟方式执行建议的方式。 如你所见,没有延迟。