HTML5 Loading data-section when click on Navigation link

前端 未结 4 1496
暖寄归人
暖寄归人 2020-12-22 01:50

I am having some road blocks getting this going. I have 4 navigation links and within the content container, I have declared a handful sections and have id tagged them accor

4条回答
  •  一整个雨季
    2020-12-22 02:18

    This could be work:

    $("a").bind("click", function(e) {
        e.preventDefault();
        var id = $(this).data("section");
          $("#content section:visible").fadeOut();
          $(id).fadeIn();
    });
    

提交回复
热议问题