Updated Plugin – jTip
Update
This plugin is no longer being supported. If you’re interested in trying a tooltip plugin with lots of features, please check out my clueTip jQuery Plugin. Thanks.
This plugin is no longer being supported. If you’re interested in trying a tooltip plugin with lots of features, please check out my clueTip jQuery Plugin. Thanks.
Using JavaScript to blur clicked links is NOT recommended because it interferes with basic accessibility, especially for those using keyboard navigation or other assistive technologies
With all the fun new things you can do using jQuery and other JavaScript libraries, people are using links ("a" tags) for much more than sending users to a different page. One little annoyance I've found when using links for these events, though, is the little dotted outline that appears around the linked words upon clicking them and making them "active."

It makes sense to see the outline when clicking, but I don't want it to stay there.
In Firefox 1.5 and up, it's easy to get rid of the outline with a little CSS:
Unfortunately, that doesn't work in Internet Explorer 6 and below (is anyone surprised?).
Wouldn't it be nice to get rid of the outline in every browser (as long as JavaScript is enabled, of course)?
The trick is to take the focus off the link once it has been clicked, and jQuery makes that simple. In the jQuery Discussion List, Klaus Hartl offered this snippet, which works perfectly:
Or, if you wanted to apply the blur only to links inside a DIV with an ID of "magic," for example, you could replace $('a') with $('#magic a'). If the blur should apply only to links with a class of "fun," the selector would change to $('a.fun'). See how easy? Give it a try:
click me and I won't show the ugly dotted outline
For this little demo, I gave the link a class of "fun" and put the above jQuery code inside $(document).ready() (For more on $(document).ready(), see Introducing $(document).ready() ). I also added return false; because I didn't want the link to take you anywhere.
A couple weeks ago someone on the jQuery discussion list asked if someone could reproduce a rotating headline box in which the headlines, in succession, scroll up into the box, pause, and then scroll up out of the box. Since I already had some code for rotating images on a page, I decided to recycle it and take the challenge.
Here is the finished product. (Please note that if you are looking at this in a feed reader, you won't be able to see the effect. )
Read the rest of this entry »While version 1.0.2 mostly tightens up code and fixes bugs, John Resig and the jQuery developer community are already working on lots of cool features and enhancements for the upcoming version 1.1, so stay tuned. Congratulations to John, Jörn, and the rest of the jQuery developers on making the best JavaScript library even better!I'd like to take this opportunity to introduce everyone to Jörn Zaefferer. Much of this release was made possible by him. He's responsible for completely overhauling the test suite (it now has over 260+ tests!) and for fixing the majority of the current bugs and enhancements (over 60 of them!).
In Fancy Drop Cap - Part 1, I showed how I used jQuery to insert a drop cap on my personal weblog. But there is still some unfinished business to take care of:
<a href="...">, <em>, etc.) So let's begin with item 1. As you may recall, we defined three variables, first_paragraph, first_letter, and text. The variables allowed us to get the value of the textNode of the first letter of the first paragraph, so we could replace it with the image. Here is what that part looked like:
The only problem with that code is that line 3 assumes that the first child node of the first paragraph is actually a text node. But what if it's a span tag (<span>) or a link (<a href="...">)? Well, in that case we'll need to keep drilling down through the nodes until we can't go any farther.
To do that, we'll set an intermediate variable, called node, initially making it the same as first_paragraph:
Next, we change our node variable to be defined as the first child of that node (node = node.firstChild), and we keep doing that until there are no more child nodes left, by using a "while" loop:
So, in other words, as long as there is a child node, our variable will be reset as that child node.
When that's all done, we set our text variable, this time as the value of our node variable:
Now all we have to do is get the first letter of the text so that we can replace it with the drop-cap image: var first_letter = text.substr(0,1).
There is just one more thing that we should account for Read the rest of this entry »
© Copyright 2006–2012 Learning jQuery and participating authors. Written content on this site is under a Creative Commons License. Code examples are under your choice of MIT or GPL license.
Development by Karl Swedberg. Design by Rex Rainey. Published with WordPress.