当url包含特定参数时隐藏页眉/页脚 [英] Hide header/footer when url contains a certain parameter
本文介绍了当url包含特定参数时隐藏页眉/页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个多页网页,在所有页面上都有页眉和页脚,并且我正在创建一个无法查看页面某些区域的应用程序,但是我不想在浏览该应用程序时显示页脚和页眉.
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 header when I am browsing through the app.
当我通过该应用访问该页面时,该应用会将一个参数添加到url中.像这样:
When I access the page through the app the app adds a parameter to the url. like this:
www.mypage.com?inapp=true
使用Java脚本和CSS最有效的方法是什么?
What is the most efficient way to this with java script and css?
推荐答案
<script>
$(document).ready(function(){
var url = window.location.href;
if(url.search('inapp=true') === true){
$('header').css('display', 'none');
}
});
</script>
这篇关于当url包含特定参数时隐藏页眉/页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文