Explaining my method of skinning the jQuery
Well, if you haven’t been reading the comments on my last post. We’ve had a nice discussion, which had me misinterpreting what Joseph was saying, not once, but twice. He was NOT planning on writting a plugin, but had to come up with a way to get the delay to work so that it would go in sequence instead of all appearing at the same time. I’ll let him write a post on his blog if he wants, explaining what he did, since he can do a better job of that than I can. But it occurred to me that some developers new to jQuery, might not have understaood what I was doing. Therefore, I will explain it in this one.
Oh and a small rant, too, on some things I’ve been seeing going around the well known blogs…but we’ll save that till the end of the post.
First, onto what the hell I did. If you recall, and you should, since it was in my last post, I was showing that there was more than one way to accomplish a task in jQuery. Again, one of the many things I love about it. But I heavily favor its motto: “Write less, do more.” Here again is the code (if you need to see the html I was using, please refer to the post before this):
var faders = $('#container').children().hide(); i = 0; function awesomeFaders() { $(faders[i++]).delay(500).fadeIn(2000, arguments.callee); }; awesomeFaders();
I want each element (divs in this case) to appear in sequence, one after another. NOT at the same time. First, I called a variable called ‘faders’. This is equal to all the direct children of a div with an id of ‘container’…which I then hide. I then set ‘i’ equal to 0 (note that ‘i’ can be anything).
Next comes a function called ‘awesomeFaders’ for lack of anything else to call it. Here is the badass part where jQuery shows its cool factor. When I had jQuery match all the children of ‘container’, it returns an array of what it finds. Doesn’t do anything with it yet, just says “Hey, I found the crap you were looking for, I’m going to order them like so for you – [div, div, div].”
Thanks, I tell it. You are the best! The index of the array it returned starts with 0. The function then takes ‘faders[0]‘, which is the first div in my array, delays it by half a second, fades it in – taking two seconds to do so, and then ends with arguemnts.callee as a callback function. What the #@!$ does that do? No need to get angry, let me explain. The callback function (arguements.callee) says, when this function is done, run it again. This time though ‘i’ is incremented 1, to equal one. In this case it is the second div. So it runs the whole function again. At the end, it calls itself again, increments ‘i’ 1 again, and repeats until it gets through the array of elements.
Of course the function won’t do anything until its called, which is what I do in the last line. Its such a small thing to do, but jQuery makes it look slick and easy.
Now onto the rant. I’m not sure if any of you have been paying attention, but there some things that some of the well known blogs have been posting which seem totally pointless to the unknown developer blog or just plain ole’ designer. Take for example, this new site: endor.se. It is for the freelancer that has too much work (oh, you poor bastards!). They can then recommend people that they “endorse” to do the job for them. Basically passing work on to friends. I know what you are thinking, because I thought it to: “That is freakin’ AWESOME! I can get some freelance work through this site!” That is what I thought too….until I read this article over at drawar.com, in which he calls it a circle jerk. This was after I signed up for an account of course. I then really though about it. Who the hell do I know in the design community, especially since most there are the upper class of the design world, that is going to “endorse” me?? Do you think Chris Coyier of CSS-Tricks is going to recommend me? Hell no. He’s going to recommend all the people he knows, which I can tell you, is not us.
I’m not putting you down by the way, but I think you and I both know, we are not in the “in” crowd. You would have to get all the people that YOU know to sign up too, to get someone to actually endorse you.
This same kind of thing happens with that site dribble. Their thing is, “Hey, show off your work!” But guess what…you have to be invited to be able to be a member of the site. And each member is only allowed to invite 2 or so others per month. Guess who is on the initial list? Ya, again, all the really freakin’ popular dev bloggers. Do you think they are going to invite me? You? Unless you are one of the elite, you can forget it. And it isn’t about, “Hey check out what I’m working on!” And then its just some normal site. Nope! One guy I saw on there is the guy that designed the site for joystiq.com (a good video gaming blog/mag by the way..and yes, it is a good design). But you can bet your ass they are not going to put someone like me….or you (sorry to insult, but I mean the peasants of the dev community which I’m trying to move up and out of)? Hell no.
So the 50 tweets I go relating to these sites “Hey, come check this awesome site out. Dribble is great!” or “Come join, endor.se! It is a great way to get some side work!” are pretty pointless to the average dev person.
I’ve also seen some articles about “How to get your blog’s readership up!” or “How to monetize your blog!”. Guess who the people they asked these questions are? That’s right, not someone who is just getting their stuff going, but the guys at the top of the chain. All the design/dev blogs we all go to. “I’ve just started another project, and in 2 weeks, I had 5,000 people subscribe, and blah blah blah…”. Ya, you know why? BECAUSE YOU ARE ALREADY WELL KNOW! OF COURSE PEOPLE ARE GOING TO COME TO YOUR NEW SITE. They already know who you are! If it had been from a guy who has a blog that has only like 100 subscribers and it is starting to catch on, talk about this stuff, it would be more relevant to the rest of us in the same boat.
I’m seriously getting tired of the crap that is getting posted lately, that holds no real value for the little guys. If you want to actually show me stuff like that, start a new blog, use a fake name so no one knows you are one of the elite peeps, don’t tell anyone you are doing it, and THEN show me how you got things done with it. THEN…THEN I will be very interested in what he/she has to say.
End of rant. I know it was pointless, but I was getting irritated. Thanks for reading it though.
jQuery junkBox
.remove();
This method will remove all matched elements from the DOM. Pretty self explanatory. Below, it removes anything with the class of ‘suckyClass’ from an element with an id of ‘kickAss’.
$('#kickAss').remove('.suckyClass');
Tags: jQuery







Blogging and getting readers is actually pretty easy. It’s finding the time that sucks.
I believe my system works pretty well. Go to popular blogs and then follow the blogs of those who comment. What’s even better is when you can follow the chain down and really start to build relationships. You’ll find really great blogs this way with people that are willing to link and comment.
I’d love to be able to spend a few hours a day building links and relationships, because it’s fun and helps the search engine rankings. Unfortunately, now that I actually have a decent amount of freelance jobs, I just don’t have that time.
Plus homework. That’s a bummer.