HTML5 loading a
content into a main view wrapper?

前端 未结 3 1402
星月不相逢
星月不相逢 2021-01-25 23:17

I am no stranger to front-end development, but I have come across a requirement by a client which I have never done before, and I would appreciate it if someone can point me int

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-25 23:42

    If you're populating all the section-s on your page you can try this - http://jsfiddle.net/Fyhm7/

    HTML

    Home
    Products
    Contact
    
    
    Home
    Products
    Contact

    JS

    $("a").on("click", function() {
        var id = $(this).data("section");
    
        $("section:visible").fadeOut(function() {
            $(id).fadeIn();
        });
    });
    

提交回复
热议问题