亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Multiple pages share the same navigation. How can this shared navigation be introduced to avoid duplication?
PHPz
PHPz 2017-05-19 10:37:36
0
2
970

A very common scenario. In the past, PHP's include was used to introduce it. What methods can be used at the front desk to do this?
The libraries currently introduced include jQuery and Webpack

Things that come to mind are:

  1. Send an Ajax request and put the requested page into the container:

    $.get("header.html",function(data){
       $("#header").html(data);
    });
  2. Make the navigation a jQuery component and initialize each page used

    `$("#header").initHeader()`
    

Are my two ideas correct?
What other methods are there?
And what are the commonly used methods?

PHPz
PHPz

學習是最好的投資!

reply all(2)
洪濤

There should still be a template file. It feels weird to implement it using jq components...

世界只因有你

Write nav into public js and initialize it there.
No need to initialize in every page.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template