Robert Taylor
Robert Taylor

Reputation: 89

Div transition triggered by a tags

I am playing around with this fiddle I found which is really close to what I am trying to do:

http://jsfiddle.net/5N3YK/20/

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

Answers (4)

gopi1410
gopi1410

Reputation: 6625

Updated fiddle: http://jsfiddle.net/UDt7q/22/

Upvotes: 1

Travis
Travis

Reputation: 12379

This should work for you: http://jsfiddle.net/5N3YK/23/

I changed the functionality of the code to hide the divs rather than push them off the page, but the idea is the same.

sections are now divs and they fade rather than slide.

Upvotes: 0

Zoltan Toth
Zoltan Toth

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

yadutaf
yadutaf

Reputation: 7152

To make something "appear", you can use

$('.selector').fadeIn();

from Jquery. Similarly, you can show(), hide(), fadeOut()

Upvotes: -1

Related Questions