Multiple distinct pages in one HTML file

后端 未结 12 1038
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 10:05

Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages:

Page 1 : cl         


        
12条回答
  •  悲&欢浪女
    2020-12-04 10:51

    going along with @binz-nakama, here's an update on his jsfiddle with a very small amount of javascript. also incoporates this very good article on css navigation

    update on the jsfiddle

    Array.from(document.querySelectorAll("a"))
    .map(x => x.addEventListener("click", 
      function(e){
        Array.from(document.querySelectorAll("a"))
        .map(x => x.classList.remove("active"));
        e.target.classList.add("active");    
      }
    ));
    

提交回复
热议问题