Reputation: 89
I am playing around with this fiddle I found which is really close to what I am trying to do:
The only thing is that when I try to change the section
tags to div
tags it breaks, and also I want the div's to fade instead of slide.
Help is always greatly appreciated!
Upvotes: 0
Views: 109
Reputation: 12379
This should work for you: http://jsfiddle.net/5N3YK/23/
I changed the functionality of the code to hide the div
s rather than push them off the page, but the idea is the same.
section
s are now div
s and they fade rather than slide.
Upvotes: 0
Reputation: 47687
Try - http://jsfiddle.net/UDt7q/21/
(function($) {
$.fn.Fader = function() {
this.each(function() {
$('a').bind('click', function(e) {
e.preventDefault();
$( "#hello div" ).fadeOut();
$( "#hello div" + $(this).attr('href') ).fadeIn();
})
});
}
})(jQuery);
Upvotes: 1
Reputation: 7152
To make something "appear", you can use
$('.selector').fadeIn();
from Jquery. Similarly, you can show(), hide(), fadeOut()
Upvotes: -1