Hi
I'm trying to increment a value every second on the client side with jquery
this is what did:
<script type="text/javascript">
$(document).ready(function increment(){
$("#counter").text(parseInt($("#counter").text())+1);
setTimeout(increment(),1000)
})
</script>
this is not working as expe...
Hello,
My question is the following:
What is the best way for looping some json array too show some data with
like a one second delay.
The one below does not work, because it only shows one message once instead of 4
jQuery.each(data.user, function(index, itemData) {
timerid = setTimeout(function(){showMessage(itemData);}, 100...
I'm trying to load random items into a div every few seconds, with a nice fadeOut/fadeIn transition between each load. Here's the code:
<html>
<body>
<div id="item"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
...
I've read some of the other related questions (http://stackoverflow.com/questions/214491/pattern-for-wrapping-an-asynchronous-javascript-function-to-make-it-synchronous & http://stackoverflow.com/questions/518880/make-async-event-synchronous-in-javascript & there may be more), but I just want to be sure to exhaust all possibilities.
M...
I'm working on some out transitions on image when a user presses the button to move to the next image. When there are multiple images next to each other that are very narrow, those images will all transition at the same time. So I check the width on the images and add the thin ones to an array and then run the transition on each object i...
EDIT: I figured out the answer to the original YUI3 question I posted here, but it led to another one and instead of starting a new thread I thought I'd just add it here. Please scroll down for the new question (it's bolded).
Original question:
I'm having some issues creating a JavaScript countdown timer inside a YUI definition, my gues...
I'm looking to setup a web page that samples data via AJAX calls from an embedded web-server. How would I set up the code so that one request doesn't overlap another?
I should mention I have very little JavaScript experience and also a compelling reason not to use external libraries of any size bigger than maybe 10 or so kilobytes.
...
I would like to be able to use jQuery's scrollTo plugin to animate the window scroll down to a div when Google directions are loaded. Could someone please help me convert the setTimeout line to jQuery and use scrollTo to animate the scroll? Here is the javascript that doesn't scroll:
GEvent.addListener(gdir, 'load', onGDirections...
The window.setTimeout (and related setInterval) function in Javascript allows you to schedule a function to be executed sometime in the future:
id = setTimeout(function, delay);
where "delay" is the number of milliseconds into the future at which you want to have the function called. Before this time elapses, you can cancel the timer...
<script type="text/javascript">
function changeBarAWidth(){
var bar = document.getElementById('firstbar');
bar.style.width = lengthA+"px";
}
function increaseBarA(){
if(lengthA < fullBarA){
changeBarAWidth();
lengthA = (lengthA + 2);
setTimeout("increaseBa...
function load_result()
{
$.getJSON( "http://somesite.com/loadresult.php", function(data) {
if( data == undefined || data == null )
{
console.log( "no data" );
clearTimeout( lr_timeout );
lr_timeout = setTimeout( "load_result()", 2000 );
return;
}
insert_r...
Here's my issue. I have this function to test proxy servers.
function crawl() {
var oldstatus = document.getElementById('status').innerHTML;
document.getElementById('status').innerHTML = oldstatus + "Crawler Started...<br />";
var url = document.getElementById('url').value;
var proxys = document.getElementById('proxys')....
I'm working on a proxy server checker and have the following code to start the requests at intervals of roughly 5 seconds using the setTimeout function;
function check() {
var url = document.getElementById('url').value;
var proxys = document.getElementById('proxys').value.replace(/\n/g,',');
...
Hey there, I am trying to have a div "hide", then "remove" once the hide animation is finished. It seems I can get either to work, but not both. I have tried using the setTimeout, but this only results in the div getting hidden, but not actually removed.
Here is the code:
$(this).parents("div:eq(0)").hide("fast");
setTimeout(function (...
How do I pass context into setTimeout? I want to call this.tip.destroy() if this.options.destroyOnHide after 1000 ms. How can I do that?
if (this.options.destroyOnHide) {
setTimeout('this.tip.destroy()', 1000);
}
When I try the above, "this" refers to the window.
...
Say you have a bunch of elements on a webpage you don't use much, how can jQuery fade them a little, but only when there is no mouseover? It must fade back on mouseover!
...
I would like to have a pulldown menu close itself upon a mouseleave event, after a short delay. But I'm having trouble getting it working.
Consider the following methods in an object: (I am using jQuery)
myObj = {};
myObj.message = "woot!";
myObj.bindEvents = function() {
var that = this;
$("#menuPanel")
...
HTML:
<ul class="topnav">
<li><a href="#"><span>One</span></a></li>
<li><a href="#"><span>Two</span></a></li>
<li>
<li><a href="#"><span>Three</span></a></li>
<ul class="subnav">
<li><a href="#">A</a></li>
<li><a href="#">B</a></li>
<li><a href="#">C</a></li>
</ul>
...
I'm having an issue with building a Javascript object, and calling methods within that object using setTimeout. I've tried various workarounds, but always during the second part of my loop the scope becomes the window object rather than my custom object. Warning: I'm pretty new at javascript.
my code:
$(function() {
slide1 = Object...
hello guys.. i'm trying to make a replacement for a flash movie.
the animation is really simple, background image slide to the left for 10 seconds.. meanwhile a product is shown with his name.
i was able to recreate the animation with jquery.. it works perfec.. BUT JUST ONCE! T_T
does anybody know how can i make it to loop?
this is t...