Using jQuery's ready() method and callback functions to get your animations to queue smoothly
One of my long time followers and most likely my biggest fan, ran into a little jQuery problem the other day and e-mailed me to see if I could help out. Here's what he had to say:
I am trying to get jQuery to do a fade, a slideDown, and a fade. I need to delay each by a few seconds, or ideally have them trigger after the previous effect completes. I can't seem to figure it out. Your an awesome guy, think you can help out?
The secret to getting me to look at something is to call me "Awesome"!
Reason #592 why I hate Internet Explorer
My last step on any website design is to go through it and make sure that it works and look correct in the various flavors of Internet Explorer. I can't really say that the time spent doing this is blissful. I compare it to going to the dentist, because I never know what I'm going to find and when I do it's rarely good.
So today as I was debugging, what I thought was a very simple, JavaScript page. I came across one of those nifty "This method or function is undefined" errors from the Internet Explorer debugger. And as we all know, the IE debugger is as worthless as playing "I Spy" with a blind person.
JSLint Keeps Warning Me About Calling a Function Within A Loop
I use JSlint to check my JavaScript on a regular bases, most of the time it just for light scripts that I just need to check to make sure that I don't have a typo. But occasionally I check more robust scripts and I find myself presented with an error message that says "Problem at line XXX character XX: Be careful when making functions within a loop. Consider putting the function in a closure".
I know I've come across this in the past and I know that I fixed it, but the problem is I can never remember what the heck I did to fix it. Then I remembered that I have a blog! I can just put it there and never have to search far for the answer ever again!
Here's the problem:
function myHappyFunction() {
var a = document.getElementsByTagName('a');
for(var i = 0; i <= a.length - 1; i++) {
a[i].onclick = function(e) {
alert('Ouch!');
};
}
}
setAttribute("style","YOUR STYLE INFO")
I'm right in the middle of a couple of large projects right now, hence the lack of posts lately, but I wanted to share a little problem I just ran into with everyone.
I like to keep my JavaScript condensed, so I like to use setAttribute for style information. But one of my clients reported a problem with a simple survey window I created recently. Apparently, Internet Explorer (go figure) wasn't playing nice with the script I created.
Happy New Year Everyone!!
You might have been asking where I went, well rest assure I'm still around. I've been completely swamped with projects and as I wrap one up another seems to start. I'm starting to see the light at the end of the tunnel, but I think I'm still a couple of weeks away from some freedom.
In the meantime, how about a little present? Maybe CJ File Browser v2.0 (Beta)!!!
Thought you might like that. I've had this for awhile, but I just didn't have the time to clean up the documentation, comments etc. But I'll let you play with it and let me know if you come accross any problems.
The big change, that I've made this into a tinyMCE plug-in.
Download here: CJ File Browser
P.S. It's a ColdFusion File Browser for tinyMCE, in case you didn't know.