setinterval

jQuery Cycle running sequence of multiple rotators

岁酱吖の 提交于 2019-12-25 05:23:00
问题 I am attempting to have 3 rotators on a page that run in a sequenced fashion but without synced transitions. I wrote the below code, thinking I could set an interval function to run every second, keep a count of the times it is accessed, and modulus the result by ten to get my action points. This however is not working as expected. #rotate2 starts as expected, then #rotate3, but then it goes back to #rotate2. Following things get really out of whack, slides disappear all together, etc. I also

JavaScript Duration of animation isn't exact

扶醉桌前 提交于 2019-12-25 04:03:17
问题 First of all I want to mention two things, One: My code isn't perfect (esspechially the eval parts) - but I wanted to try something for my self, and see if I could duplicate the jQuery Animation function, so please forgive my "bad" practices, and please don't suggest that I'll use jQuery, I wanted to experiment. Two: This code isn't done yet, and I just wanted to figure out what makes it work badly. So the animation runs for about 12 seconds while the duration parameter I entered was 15

向setInterval , setTimeout调用的函数传递参数

走远了吗. 提交于 2019-12-25 03:45:18
setTimeout 或 setInterval 调用的函数不能直接传递参数,以下为解决这个问题提供了一种可行的解决方案,个人比较推崇这种方式. window.onload = function(){ window.setTimeout(getFunToExecute(add,1,2),10); //add为要调用的函数,1,2..为 add的参数 //getAfun是关键,通过它可以为setTimeout 或 setInterval调用的函数传递参数 } function getFunToExecute(fun){ var args = Array.prototype.slice.call(arguments).slice(1); return function(){ fun.apply(window,args); } } function add(x,y){ alert(x+y); //return x+y; } 来源: https://www.cnblogs.com/amylis_chen/archive/2011/08/14/2138429.html

setInterval fires only once

十年热恋 提交于 2019-12-25 03:44:17
问题 I'm trying to create a self contained timer where all variables are inside a object. For the most part it works but I can get this to fire once. What am I missing? function Countdown() { this.appId = null; this.timerId = null; this.seconds = null; this.decrementCounter = function (instant) { if (instant == null) return; instant.tick(); if (instant.seconds === 0) { instant.tickEnd(); instant.stop(); } instant.seconds--; }; this.tick = function () { var xx = this.appId }; this.tickEnd =

What is a good setTimeout interval for polling in a IE?

≯℡__Kan透↙ 提交于 2019-12-25 03:07:30
问题 I have an ActiveX object (who source code I have) running in a browser (IE). The ActiveX object has a UI, which raises events. I want to respond to those events in the browser. I don't want to invoke JavaScript functions from the ActiveX object events: and therefore, instead, I want the JavaScript to poll a method of the ActiveX object (to say, "do you have any events to report?"). I'll do that with code like this: function findActiveXObject() { return document.getElementById('MyActiveXObject

Plain JS countdown with repeat and delay

耗尽温柔 提交于 2019-12-24 19:27:35
问题 I keep running into several issues when creating a countdown script it does not run smoothly hard to make it repeat (closure) hard to delay the start and to delay the repeat (closure) Can someone please help me FIX this code which should work in my opinion but doesn't the processing I need is a. counter starts delay number of seconds after the page loads, b. when counter reaches 0, the countdown RE-starts after delay number of seconds Here is my Fiddle Issues: when it starts, the counter

variable incrementer in setInterval function

这一生的挚爱 提交于 2019-12-24 14:17:39
问题 I have lot of problems with a function and I get confused with the variable scope. I tried with a callback function, but I cannot get it. I have a function to animate a background with css. I need that function doesn't restart the incrementer variable to 0 when I click for a second time while a setInterval is running. See that when you click a twice in time1 or time2 of html, the order of counter doesn't hold the order. function movie(elm,jumpPx,spriteHeight,duration){ var inc=0; var time

JavaScript context issue using setInterval with prototype

为君一笑 提交于 2019-12-24 11:53:29
问题 I'm trying to get my head round this context problem while using prototypal inheritence (which I've not really played with before). I have an AutoScroller object: function AutoScroller() { this.timer = null; } AutoScroller.prototype = { stop: function() { if (this.timer == null) { return; } clearInterval(this.timer); this.timer = null; console.log("stop"); }, start: function() { if (this.timer != null) { return; } this.timer = setInterval(function() { this.move(); }, 3000); console.log("start

How can use the setInterval() to change the text?

偶尔善良 提交于 2019-12-24 11:31:15
问题 I've been working at this for quite some time now. I'm trying to create a simple timer that counts down. I've gotten the alert() to work, but unfortunately the textToChange does not change. I've reproduced a copy of my code below. Any help would be greatly appreciated! Thank you. <script type="text/javascript"> var timeLeft = 0; var changingTextElement; var changingText = new Array(); var ctr = 0; function timeMsg(thing) { var length = thing.inputbox.value*1000; var t = setTimeout("alertMsg()

How can use the setInterval() to change the text?

馋奶兔 提交于 2019-12-24 11:29:37
问题 I've been working at this for quite some time now. I'm trying to create a simple timer that counts down. I've gotten the alert() to work, but unfortunately the textToChange does not change. I've reproduced a copy of my code below. Any help would be greatly appreciated! Thank you. <script type="text/javascript"> var timeLeft = 0; var changingTextElement; var changingText = new Array(); var ctr = 0; function timeMsg(thing) { var length = thing.inputbox.value*1000; var t = setTimeout("alertMsg()