Hide header/footer when url contains a certain parameter

前端 未结 6 1692
醉话见心
醉话见心 2021-01-22 17:18

I have a multi page webpage that has a header and footer on all pages, and I am creating an app than can view certain areas of the page, but I dont want to show the footer and h

6条回答
  •  清酒与你
    2021-01-22 17:28

    If jQuery is ok:

    var headerSelector = "#header"; // TODO: replace as needed
    var footerSelector = "#footer"; // TODO: replace as needed
    
    if(window.location.search.indexOf("inapp=true") !== -1) {
        $(headerSelector).hide();
        $(footerSelector).hide();
    }
    

提交回复
热议问题