Karl's Archive
Wednesday, December 19th, 2007
I’ve been feeling guilty lately about my lack of posts to this blog. But when I looked at my profile for the jQuery Google Group and discovered that for the past six months I’ve posted an average of 100+ times each month, well, I decided to give myself a break. Since I’m sure some people who stumble upon this blog aren’t subscribed to the Google group/mailing list, here are a few (edited) questions that have appeared there recently, along with my (edited) answers. I hope some of you find them helpful.
(more…)
Posted in Beginner, DOM Traversing, Plugins, jQuery | 22 Comments »
Friday, November 2nd, 2007
Quite a few jQuery tutorials have been posted around the web recently. It’s always great to see more people not only learning jQuery, but also teaching it to others. Here are just a few that I think could be helpful to readers of Learning jQuery:
(more…)
Posted in Announcement, jQuery | 17 Comments »
Wednesday, October 31st, 2007
Last week I attended The Ajax Experience conference in Boston (no, I didn’t go to a Red Sox game), sponsored by the folks at ajaxian.com The schedule was packed with outstanding presentations. But the highlight of my trip was jQueryCamp07, which was held at Harvard University on Saturday.
Throughout the week I had quite a few opportunities to talk with John Resig, the creator and lead developer of jQuery. But, like the social clod that I am, I forgot to do the one thing that I had set out to do: Thank John Resig, in person, for the jQuery JavaScript Library. It was only after I returned home on Sunday that I realized my oversight. So, at the risk of sounding sappy, I figure I ought to write in a public forum what I had meant to say face to face.
(more…)
Posted in Announcement, jQuery | 5 Comments »
Saturday, October 20th, 2007
After posting the last entry on animated scrolling with jQuery 1.2, I realized that I had left out an important piece of code. Actually, I didn't discover it until someone notified me that another page on the site was broken. Can you spot the problem(s)? [Note: the problem is not in line 3. The syntax highlighter just can't handle the regular expression with two slashes in it ("//") and is incorrectly treating them as a comment mark.] See the answer below the code.
JavaScript:
-
$
(document
).
ready(function(){
-
$
('a[href*=#]').
click(function() {
-
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
-
&& location.hostname == this.hostname) {
-
var $target = $(this.hash);
-
$target = $target.
length && $target
-
|| $
('[name=' +
this.
hash.
slice(1) +
']');
-
-
var targetOffset = $target.offset().top;
-
$('html,body')
-
.
animate({scrollTop: targetOffset
},
1000);
-
return false;
-
}
-
}
-
});
-
});
(more...)
Posted in Beginner, Effects, Events, Intermediate, jQuery | 31 Comments »
Sunday, September 16th, 2007
A few weeks ago I wrote about how to use jQuery and a couple modules from the Interface plugin suite to automatically have same-page links scroll to their target location when clicked (Animated Scrolling for Same-Page Links). Well, now that jQuery 1.2 is out, and I've successfully upgraded this site to it without a hitch, we can do the same thing with jQuery core alone.
Here is what the code looks like with the minor change:
(more...)
Posted in Beginner, Effects, Intermediate, jQuery | 60 Comments »
Thursday, September 13th, 2007
As I'm sure most of you have already heard, the jQuery Project Team has just released a major new version (1.2) of our beloved JavaScript Library. Hat's off to John Resig and the gang for another spectacular release!
I'm going to upgrade this site to the new version this weekend. On a typical site, I'd feel pretty confident about moving forward without any hiccups—especially after hearing all the success stories on the jQuery discussion list. But since the nature of this site is to demonstrate techniques used with jQuery, its use of the library is probably more comprehensive (for lack of a better word) than most. Therefore, I want to be extra careful. My simple plan for the transition to 1.2 is described below, along with some discussion of the API changes, in the off chance that it helps others who wish to upgrade with caution.
(more...)
Posted in jQuery | 13 Comments »