Change DIV contents using jQuery when link clicked

后端 未结 6 1598
梦毁少年i
梦毁少年i 2021-01-26 02:15

Thank you, in advance, for those who answer =)
I\'m trying to switch between divs when i click the links with the respective class (as follow on the code bellow). It works f

6条回答
  •  孤独总比滥情好
    2021-01-26 03:02

    May be this work.

    $(document).ready(function(){
        $(".content").hide();
    
        $("#cont").click(function() {
        if ($(this).hasClass("info")){ $(".info").slideToggle(500); }
        if ($(this).hasClass("gallery")){ $(".gallery").slideToggle(500); }
        if ($(this).hasClass("projects")){ $(".projectos").slideToggle(500); }
        if ($(this).hasClass("contacts")){ $(".contactos").slideToggle(500); }
            // $(".content").slideToggle(500);
        });
    
        });
    

提交回复
热议问题