Well, it's simply a matter of choice.
Using setTimeout is shorter, simpler, more readable and offers the
same performance. I consider these advantages. Maybe in some other
context setInterval would be a better fit, but in this case I'd go for
simplicity.
cheers,
- ricardo
On Jan 30, 3:56 am, Ro
On Jan 30, 6:57 am, Ricardo Tomasi wrote:
> I'm not sure there is any difference in performance,
Nor am I, who mentioned performance? It's about using the tool that's
intended for the job.
> most animations
> use setTimeout instead of setInterval for better timing too (though
> it's irrelev
I'm not sure there is any difference in performance, most animations
use setTimeout instead of setInterval for better timing too (though
it's irrelevant in this case). And it would require a bit more code.
- ricardo
On Jan 29, 2:39 am, RobG wrote:
> On Jan 16, 3:15 am, Ricardo Tomasi wrote:
>
On Jan 16, 3:15 am, Ricardo Tomasi wrote:
> Can you add a single class "sticky" to all of the notes? Then do this:
>
> $('.sticky:hidden').each(function(i){
> var t = $(this);
> setTimeout(function(){ t.fadeIn(500) }, i*100);
> });
Rather than 9 calls to setTimeout, consider one call to
Well, I should attach one class to all stickies, and fade loop them in
from there, just using class="sticky NumericValue"
That would probably be the most elegant. Although to be fair, I rather
like the chaotic way in which they appear on screen.
On Jan 15, 12:42 pm, James Van Dyke wrote:
> So,
So, the code is working as expected?
As for how it works, I'm using a basic loop to run through the
numbers: http://www.w3schools.com/JS/js_loop_for.asp
Then, I'm just concatenating a string inside the $() function. Once
the string is concatenated, it will be passed to the $() function just
as
Can you add a single class "sticky" to all of the notes? Then do this:
$('.sticky:hidden').each(function(i){
var t = $(this);
setTimeout(function(){ t.fadeIn(500) }, i*100);
});
Or if you can't change the classes:
$('[className^=sticky]:hidden').each(... //same as above
I'd prefer this o
ignore that, put the console.log() in the wrong place
Liam Potter wrote:
front what I can tell it is not looping.
DJCarbon43 wrote:
I'm not sure what it is that its choking on. It doesnt throw any
errors in Firebug or Inspector
If I do
$(function() {
var i, numStickies = 9;
for (i =
front what I can tell it is not looping.
DJCarbon43 wrote:
I'm not sure what it is that its choking on. It doesnt throw any
errors in Firebug or Inspector
If I do
$(function() {
var i, numStickies = 9;
for (i = 1; i <= numStickies; i += 1) {
setTimeout( function() {
I'm not sure what it is that its choking on. It doesnt throw any
errors in Firebug or Inspector
If I do
$(function() {
var i, numStickies = 9;
for (i = 1; i <= numStickies; i += 1) {
setTimeout( function() {
$(".sticky1:hidden").fadeIn(500);
}, 100 * i);
}
Let me know what's not working, and maybe I can help you out. I don't
have firebug handy, so I didn't test it.
On Jan 14, 11:44 pm, DJCarbon43 wrote:
> I haven't gotten it working yet, but I understand the concept, and its
> brilliant!
>
> Thank you very much!
>
> On Jan 14, 11:28 pm, James Va
I haven't gotten it working yet, but I understand the concept, and its
brilliant!
Thank you very much!
On Jan 14, 11:28 pm, James Van Dyke wrote:
> $(function() {
> var i, numStickies = 9;
> for (i = 1; i <= numStickies; i += 1) {
> setTimeout( function() {
> $(".sti
$(function() {
var i, numStickies = 9;
for (i = 1; i <= numStickies; i += 1) {
setTimeout( function() {
$(".sticky" + i + ":hidden").fadeIn(500);
}, 100 * i);
}
});
Not sure if that's faster, but it's shorter and easier to change.
On Jan 14, 11:19 pm, DJ
13 matches
Mail list logo