Registration for jQuery Conference 2008 is closed.
Effects Entries
Tuesday, February 12th, 2008
jQuery has a nice selection of core animation effects, such as .show('speed') and .hide('speed'), .slideUp() and .slideDown(), and .fadeIn() and .fadeOut(). It even has a couple methods for toggling effects — the aptly named .toggle('speed') and .slideToggle().
All of these methods have optional speed, easing, and callback arguments — although a couple are special cases. The .show() and .hide() methods, when used without a speed, will immediately show and hide the matched set of elements with no animation. When the speed argument is included, the matched elements are shown and hidden gradually by animating their height, width, and opacity simultaneously. The .toggle() method shares its name with a method that takes two arguments that alternate being triggered. All of the other effect methods have a default speed of 400ms.
(more…)
Posted in Effects, Intermediate, Plugins, jQuery | 31 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 | 32 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 | 61 Comments »
Monday, June 25th, 2007
It's been so long since I last posted a tutorial here that I'm afraid everyone might have forgotten about the place. For the past few months, there has been a little "Page Contents" menu at the top-right corner of some of the pages on this site — actually, any page that has more than one <h2> elements in the main content area. In this entry, I'd like to demonstrate how to create an automatic page contents list using jQuery.
(more...)
Posted in Beginner, DOM Modification, Effects, Intermediate, jQuery | 14 Comments »
Monday, March 5th, 2007
A few weeks ago I wrote about two ways we can achieve the "accordion menu" effect, and I promised to describe a third option. Well, this is it, Option 3. But first, here is a list of my other show-hide-toggle entries, as well as Jörn Zaefferer's accordion menu plug-in:
(more...)
Posted in Beginner, Effects, Intermediate, jQuery | 159 Comments »
Thursday, February 8th, 2007
We've received a number of comments recently from people looking for variations on the showing and hiding theme. For the basics, you can take a look at two earlier entries, Basic Show and Hide and Slicker Show and Hide.
For a full-blown plugin solution with lots of options, look no further than Jörn Zaefferer's Accordion Menu. But if you want to try some showing and hiding on your own, read on.
(more...)
Posted in Beginner, Effects, Events, jQuery | 165 Comments »