jquery - Trouble in understanding and using setInterval() with .each() -


what i'm tring here:

there few elements want show 1 1 time. so, tried using following code:

/*defining object selectors*/ var ticks_obj = {     1: "#pros1",     2: "#pros2",     3: "#pros3" };  /*using setinterval within loop 1 sec gap*/ jquery.each(ticks_obj, function(index, val){        setinterval(function(){             jquery(val).show(500);        }, 1000); }); 

trouble is:

.show() taking place @ once in elements. not 1 one.

so, changed code , did:

/*object definition here*/  /*using loop within setinterval*/ jquery.setinterval(function(){        jquery.each(ticks_obj, function(index, val){                jquery(val).show(500);        });  }, 1000); 

this showing no result.

i can't understand it. can clarify in bullet points in few words?

also easiest solution using jquery?

use

jquery.each(ticks_obj, function(index, val){        settimeout(function(){             jquery(val).show(500);        }, index * 1000); }); 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -