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 <jame...@gmail.com> wrote: > 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 if you typed it out explicitly. > > The process: > Let's say numStickies equals 1 in this iteration. > > $("#.sticky" + numStickies + ":hidden") > $("#.sticky1:hidden") > - the function is called and the elements are matched. > - etc... > > Does that make sense? > > On Jan 15, 11:09 am,DJCarbon43<djcarbo...@gmail.com> 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() { > > $(".sticky1:hidden").fadeIn(500); > > }, 100 * i); > > } > > > }); > > > It works fine (obviously) as its not pulling in the variable attribute > > (" + i + ") > > > Basically everything in > > > setTimeout( function() { > > $(".sticky1:hidden").fadeIn(500); > > }, 100 * i); > > > I get, its > > > var i, numStickies = 9; > > for (i = 1; i <= numStickies; i += 1) > > > That I don't yet understand. I see that its basically saying "there > > are 9 sticky classes. For each class, add a digit to the variable i > > for the classname , and multiply the timeout by i. > > > Its ingenious, but I haven't the first idea what is broken. > > > Basically, I have a page that I created which pulls data out of a job > > tracking database (doing this for free, in my spare time, to learn > > more about database calls, php, and js) and paints the data set that > > was queried down the page in sticky notes. It randomizes the color of > > the notes, and onload fades them in. There may be 50 stickies, or as > > few as one or two. Its pretty neat, and its working right now, but I'd > > love to better understand your method. > > > Thanks again! > > D > > > On Jan 15, 12:21 am, James Van Dyke <jame...@gmail.com> wrote: > > > > 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<djcarbo...@gmail.com> 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 Van Dyke <jame...@gmail.com> wrote: > > > > > > $(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,DJCarbon43<djcarbo...@gmail.com> wrote: > > > > > > > Being a bit of a newfie, I was wondering how this function could be > > > > > > condensed: > > > > > > > $(document).ready = > > > > > > setTimeout(function(){ $(".sticky1:hidden").fadeIn(500); }, > > > > > > 100); > > > > > > setTimeout(function(){ $(".sticky2:hidden").fadeIn(500); }, > > > > > > 200); > > > > > > setTimeout(function(){ $(".sticky3:hidden").fadeIn(500); }, > > > > > > 300); > > > > > > setTimeout(function(){ $(".sticky4:hidden").fadeIn(500); }, > > > > > > 400); > > > > > > setTimeout(function(){ $(".sticky5:hidden").fadeIn(500); }, > > > > > > 500); > > > > > > setTimeout(function(){ $(".sticky6:hidden").fadeIn(500); }, > > > > > > 600); > > > > > > setTimeout(function(){ $(".sticky7:hidden").fadeIn(500); }, > > > > > > 700); > > > > > > setTimeout(function(){ $(".sticky8:hidden").fadeIn(500); }, > > > > > > 800); > > > > > > setTimeout(function(){ $(".sticky9:hidden").fadeIn(500); }, > > > > > > 900); > > > > > > > Is it possible, or is that as clean as can be? fadein time is the > > > > > > same > > > > > > accross all sticky classes, but the timeout must be different for > > > > > > each.