DarkLeafyGreen
DarkLeafyGreen

Reputation: 70406

jQuery: just show/hide and not slideIn/Out

I am working on a tabbed navigation, here is an example . For now the contens slidesUp/Down but I want it just to disappear/appear. Any Ideas?

  // When the document loads do everything inside here ...
  $(document).ready(function(){

    // When a link is clicked
        $("a.tab").click(function () {              

            // switch all tabs off
            $(".active").removeClass("active");

            // switch this tab on
            $(this).addClass("active");

            // slide all content up
            $(".content").slideUp();

            // slide this content up
            var content_show = $(this).attr("title");
            $("#"+content_show).slideDown();

        });

      });

Upvotes: 1

Views: 138

Answers (2)

Andy
Andy

Reputation: 30135

or

$(".content").fadeOut();

and

$("#"+content_show).fadeIn();

Upvotes: 0

rahul
rahul

Reputation: 187020

Replace

$(".content").slideUp();

with

$(".content").hide();

and

$("#"+content_show).slideDown();

with

$("#"+content_show).show();

Upvotes: 8

Related Questions