settimeout

my setTimeout doesn't work correctly

雨燕双飞 提交于 2019-12-11 19:42:32
问题 this is the code: var stripeAnimation = function() { var streetDivWidth = $('.street_name').width(); var streetFull = $('.street_name .street_name_text'); for(var i=0; i<streetFull.length; i++) { var item = $(streetFull[i]); var widthFull = item.width(); var remainder = widthFull - streetDivWidth; var animationSpeed = widthFull * 5; var summary = streetDivWidth - widthFull; if(summary < 0) { item.children('.gradient_span').addClass('gradient'); infinite(); setTimeout(infinite, 1000); } }

Print timestamp in a file not changing timestamp value

こ雲淡風輕ζ 提交于 2019-12-11 18:32:00
问题 I am trying to print the current timestamp in a file using Timers in Nodejs. If I'm using setInterval , I am able to print the current timestamp in the output file, but the the value of it never changes... (it takes the first value of timestamp and then it just prints it every 1000ms....) This was the code: export class App { private getData() { return Date.now(); } private async printToFile(path: string, data: number) { try { fs.writeFile(path, data + '\n', { 'flag': 'a' }, function (err) {

Settimeout() javascript function is ignored

為{幸葍}努か 提交于 2019-12-11 18:16:35
问题 i have a simple button in my aspx page: <asp:Button ID="a1" runat="server" OnClientClick="test2();" /> and the javascript function is: function test2() { setTimeout("alert('hello')", 1250); } The SetTimeout is totaly ignored - the alert won't show and the timer won't wait. i read about 10 posts about this problem on ths site , none of the solutions work. i tried calling another function instead of the alert function, i tried calling function with parameters using the function(){..}. i also

jQ Auto Grow Text Area issues - Delaying expansion & padding issue

戏子无情 提交于 2019-12-11 17:53:24
问题 I've implemented a standard jQuery auto grow/expand textarea plugin into iPhone my web app . It's working fine except for two issues (listed below) . Firstly, allow me to stress that I've tried googled and experimented with different tutorial and come to the conclusion that this is the best one for my needs. Issue 1. Delaying expansion of textarea onKeyUp. How? The function expand is called on keyup: $(this).keyup(update); Since i'm using CSS3 animation (-webkit-transition) to animate the

No idea where to put settimeout

我是研究僧i 提交于 2019-12-11 17:48:15
问题 So I have very limited knowledge of javascript, so I apologize in advance for my stupidity. I am trying to make it so that these alerts play 16 seconds after the website is initially opened. In the background, there is a video playing and it seems like the video has an effect on the website, but in reality, it's just played in a particular way. How can I get it so that the three alerts play 16 seconds from the opening of the website? Where do you put the settimeout, or where in the code do

clearTimeout not working

两盒软妹~` 提交于 2019-12-11 17:17:53
问题 I'm trying to make image rotator with Jquery, but my rotator won't stop when I put the mouse over the images, so I'm guessing that something's wrong with clearTimeout. Here's my code: $(document).ready(function () { var o = 0 var t = null; stop = false; $("img:gt(0)").hide(); broj = ($("img").size()); function promena() { o++; if (o == broj) { o = 0; $("img:lt(3)").hide(function () { $("img").eq(3).delay(1000).fadeOut(1000); }); } $("img").eq(o).delay(1000).fadeIn(1000, function () { t =

I need stop a loop with setTimeout inside in JavaScript

余生颓废 提交于 2019-12-11 14:52:17
问题 i have a loop with setTiemout inside and i need stop it via onClick button var loop = function(){ for (var i = 0; i < tx.length; i++) { setTimeout((function(x) { return function() { $("#div").append(tx[x] + " <br />"); }; })(i), 500 * i); } }; $("#start").on("click", loop); $("#stop").on("click", stop); i have the example in JSFiddle start|stop loop with buttons Thank's 回答1: How about this? var tx = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "g", "k", "l", "m", "n", "o", "p", "q", "r", "s"

jQuery each with timeout

三世轮回 提交于 2019-12-11 14:47:11
问题 I have the following function which runs OK except for one thing. There is no consequence in what it appends first. (function biograf(){ var placeholder = $('#top-imageholder'); $('ul#biomenu > li').each(function(){ var obj = $(this); var pageLink = obj.find('a:first').attr('href'); $.get(pageLink, function(data) { placeholder.append( $(data).find('#top-imageholder').html() ); placeholder.append( $(data).find('#top-imageholder').siblings('ul') ); }); }); })(); I would like the function to

Settimout not working inside For loop, acting weird?

情到浓时终转凉″ 提交于 2019-12-11 14:44:18
问题 Im trying to simulate a Typewriter effect with javascript. Theorically it should work with my code: function TypeWriteToDoc(txt, id, x){ document.getElementById(id).innerHTML = document.getElementById(id).innerHTML + txt.charAt(x); } function TypeWrite(txt,id){ for (var i = 0; i < txt.length; i++){ setTimeout(function() { TypeWriteToDoc(txt, id, i); }, 1000*(i+1)); } } That should be it, when i call TypeWrite("example", "p_test"); it should write each character of "test" in the "p_test" html.

JS : Using a setTimeout inside a setInterval, the setTimeout has no effect

僤鯓⒐⒋嵵緔 提交于 2019-12-11 13:19:12
问题 I'm trying to make random images move upwards then return to their original position. <script> var looper = setInterval(animateAll, 2000, myArray); function animateAll(myArray) { // Gets a random image ID var randomId = myArray[Math.floor(Math.random()*myArray.length)]; // Make that random icon bounce bounce(randomId) ; } function bounce(randomId) { var icon = document.getElementById(randomId) var top = icon.offsetTop; setTimeout ( icon.style.top = top-20 + "px", 500) ; setTimeout ( icon