当我的响应菜单打开时,我如何删除用户转到侧面的功能
How can I remove the ability for the user to go to the sides when my responsive menu is open?
我使用一些JavaScript函数来处理响应菜单,但我遇到了一个问题。到目前为止,我的菜单功能很好,但我希望当它打开时,用户没有机会站在一边。以下是视频中的问题:http://screencast.com/t/yQkGV9XTJm
这是我的JavaScript代码:
(function($)
{
$('#side-block-toggle-icon').click(function(e)
{
e.preventDefault();
$('body').toggleClass('side-block');
$('#expose-mask').toggle();
});
$('#expose-mask').click(function(e)
{
$('body').removeClass('side-block');
});
})(jQuery);
我的HTML代码:
<!-- NAVIGATION -->
<div id="navigation">
<div class="wrapper">
<span id="side-block-toggle-icon" title="Navigation"></span>
<div id="side-block">
<ul>
<li>
<a href="../." class="home active">Home</a>
</li>
<li>
<a href="../shop/shop.php" class="shop ">Shop</a>
</li>
<li>
<a href="../community/" class="forums">Community</a>
</li>
<li>
<a href="#" class="support ">Support</a>
</li>
</ul>
</div>
</div>
</div>
<!-- HEADER -->
<div id="header">
<div class="wrapper">
<h1 id="logo">
<a href="../.">Logo</a>
</h1>
</div>
</div>
<!-- CONTAINER -->
<div class="wrapper">
<div id="container">
<div id="breadcrumb-top" class="breadcrumb">
<ul>
<li>
<a href="./.." class="home">Home</a>
</li>
</ul>
</div>
<h1 id="welcome-to" class="big-title">Web site for highly customized styles for the <a href="http://xenforo.com" target="_blank" style="border-bottom: 2px solid;">XenForo forum software</a>.</h1>
<h1 id="all-available-styles" class="big-title">All available styles</h1>
<p>Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.</p>
<div id="breadcrumb-bottom" class="breadcrumb">
<ul>
<li>
<a href="./.." class="home">Home</a>
</li>
</ul>
</div>
</div>
</div>
<div id="footer">
<div class="wrapper">
<ul>
<li>
<a id="help" class="overlay-trigger" href="help.php">Help</a>
</li>
</ul>
<span id="footer-copyright">
<a href="./..">Coded by Dylan.</a>
</span>
</div>
</div>
<div class="overlay-box">
<div class="overlay-box-container">
<span class="overlay-box-closer" title="Close the overlay"></span>
<h1 class="big-title">Help</h1>
<p>Your privacy is important to us. To better protect your privacy we provide this notice explaining our online information practices and the choices you can make about the way your information is collected and used. To make this notice easy to find, we make it available in our footer and at every point where personally identifiable information may be requested.Log files are maintained and analysed of all requests for files on this website's web servers. Log files do not capture personal information but do capture the user's IP address, which is automatically recognised by our web servers.</p>
</div>
</div>
<div id="expose-mask" style="display: none;"></div>
<script src="javascript/scripts.js"></script>
和我的CSS代码:
.overlay-box
{
background-color: #FFFFFF;
display: none;
position: fixed;
top: 35%;
right: 0;
left: 0;
z-index: 3;
width: 50%;
margin: 0 auto;
box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 7px;
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 7px;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 7px;
transition: opacity 500 ease-in-out;
-webkit-transition: opacity 500 ease-in-out;
}
.overlay-box-container
{
margin: 20px;
}
.overlay-box-closer:before
{
content: "'f00d";
position: absolute;
top: -21px;
right: -15px;
cursor: pointer;
font-size: 40px;
}
.big-title
{
margin-bottom: 20px;
}
/* BASE */
h1, h2, h3, h4, h5, h6
{
font-weight: normal;
}
h1
{
font-size: 25px;
}
h2
{
font-size: 20px;
}
h3
{
font-size: 18px;
}
h4
{
font-size: 17px;
}
h5
{
font-size: 15px;
}
h6
{
font-size: 13px;
}
ul, p, h1, h2, h3, h4, h5, h6
{
margin: 0;
}
ul
{
list-style-type: none;
padding: 0;
}
/* CORE */
html
{
overflow-x: hidden;
}
body
{
background-color: #E6E9ED;
color: #000000;
font-family: Amaranth, ABeeZee, "Trebuchet MS", sans-serif;
font-size: 13px;
margin: 0;
padding-bottom: 20px;
transition-duration: 0.3s;
-webkit-transition-duration: 0.3s;
-moz-transition-duration: 0.3s;
-o-transition-duration: 0.3s;
}
.wrapper
{
max-width: 975px;
margin: 0 auto;
padding: 0 20px 0 20px;
}
a
{
color: #4D7799;
text-decoration: none;
}
a:hover
{
color: #CD3816;
text-decoration: none;
}
#navigation a:before,
#navigation a:after,
#side-block-toggle-icon:before,
#side-block-toggle-icon:after,
#all-available-styles:before,
#all-available-styles:after,
#slideshow-pause-icon:before,
#slideshow-pause-icon:after,
#slideshow-play-icon:before,
#slideshow-play-icon:after,
#join-us-now:before,
#join-us-now:after,
#footer a:before,
#footer a:after,
.overlay-box-closer:before,
.overlay-box-closer:after
{
font-family: FontAwesome;
font-weight: normal;
}
/* NAVIGATION */
#navigation
{
background-color: #283a4a;
height: 60px;
}
#navigation li
{
float: left;
}
#navigation a
{
color: #FFFFFF;
font-size: 13px;
text-shadow: rgba(0, 0, 0, 1) 0 1px 0;
display: block;
padding: 0 20px;
line-height: 60px;
}
#navigation a:hover
{
background-color: #000000;
text-decoration: none;
}
#navigation a.active
{
background-color: #000000;
font-weight: bold;
}
/* Navigation icons */
#navigation a:before
{
float: left;
font-size: 18px;
margin-right: 5px;
}
#navigation a.home:before
{
content: "'f015";
}
#navigation a.shop:before
{
content: "'f07a";
}
#navigation a.forums:before
{
content: "'f086";
}
#navigation a.support:before
{
content: "'f1cd";
}
#side-block-toggle-icon
{
display: none;
text-align: left;
line-height: 60px;
margin-left: 20px;
}
#side-block-toggle-icon:before
{
content: "'f0c9";
font-size: 28px;
color: #FFFFFF;
text-shadow: rgba(0, 0, 0, 1) 0 1px 0;
cursor: pointer;
}
/* HEADER */
#header
{
background-color: #3d5e78;
height: 150px;
margin-bottom: -75px;
}
#logo
{
float: left;
}
#logo a
{
color: #FFFFFF;
text-shadow: rgba(0, 0, 0, 1) 0 1px 0;
line-height: 75px;
}
#logo a:hover
{
text-decoration: none;
}
/* CONTAINER */
#container
{
background-color: #FFFFFF;
box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 7px;
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 7px;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 7px;
overflow: hidden;
padding: 20px;
}
/* Breadcrumb */
.breadcrumb
{
background-color: #F5F5F5;
height: 50px;
margin: -20px;
overflow: hidden;
}
.breadcrumb li
{
float: left;
}
.breadcrumb a
{
color: #000000;
text-shadow: #FFFFFF 0 1px 0;
margin-left: 20px;
line-height: 50px;
}
.breadcrumb a:hover
{
color: #CD3816;
}
.breadcrumb-separator
{
margin-left: 20px;
}
#breadcrumb-top
{
margin-bottom: 20px;
border-bottom: #CCCCCC 1px solid;
}
#breadcrumb-bottom
{
margin-top: 20px;
border-top: #CCCCCC 1px solid;
}
#welcome-to,
#all-available-styles
{
text-align: center;
}
#all-available-styles
{
margin-bottom: 25px;
}
#all-available-styles:before,
#all-available-styles:after
{
content: "'f122";
display: inline-block;
font-size: 28px;
position: relative;
top: 10px;
}
#all-available-styles:before
{
transform: rotate(250deg);
-webkit-transform: rotate(250deg);
-ms-transform: rotate(250deg);
-moz-transform: rotate(250deg);
margin-right: 5px;
}
#all-available-styles:after
{
margin-left: 5px;
transform: rotate(100deg) scaleX(-1);
-webkit-transform: rotate(100deg) scaleX(-1);
-ms-transform: rotate(100deg) scaleX(-1);
-moz-transform: rotate(100deg) scaleX(-1);
}
/* FOOTER */
#footer
{
text-align: center;
margin-top: 20px;
}
#footer ul
{
display: inline-block;
}
#footer li
{
float: left;
margin-bottom: 15px;
}
#footer li:not(:first-child):not(:last-child)
{
margin: 0 20px 0 20px;
}
#footer a
{
color: #000000;
text-shadow: #FFFFFF 0 1px 0;
}
#footer a:hover
{
color: #CD3816;
}
#footer-copyright
{
display: block;
color: #808080;
text-shadow: #FFFFFF 0 1px 0;
}
#footer-copyright a
{
color: #808080;
text-shadow: #FFFFFF 0 1px 0;
}
#footer-copyright a:hover
{
color: inherit;
}
/* Footer icons */
#footer a:before
{
font-size: 18px;
margin-right: 5px;
}
#footer a.home:before
{
content: "'f015";
}
#footer a.shop:before
{
content: "'f07a";
}
#footer a.forums:before
{
content: "'f086";
}
#footer a#help:before
{
content: "'f1cd";
}
#expose-mask
{
background-color: rgba(0, 0, 0, 0.6);
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 2;
}
/* RESPONSIVENESS */
@media screen and (max-width: 780px)
{
.wrapper
{
padding-left: 0;
padding-right: 0;
}
#navigation
{
position: inherit;
}
#navigation li, #navigation a:before
{
float: none;
line-height: 0;
}
#side-block-toggle-icon
{
display: inherit;
}
#side-block
{
background-color: #283A4A;
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 250px;
transform: translateX(-250px);
-webkit-transform: translateX(-250px);
-ms-transform: translateX(-250px);
-moz-transform: translateX(-250px);
}
#side-block a
{
text-align: center;
}
.side-block
{
transform: translateX(250px);
-webkit-transform: translateX(250px);
-ms-transform: translateX(250px);
-moz-transform: translateX(250px);
}
#side-block-toggle-icon a
{
text-align: center;
}
#logo
{
float: none;
text-align: center;
}
#all-available-styles
{
font-size: 24.2px;
}
.slideshow-pause-and-play-icon
{
opacity: inherit;
}
}
您可以在此处进行实时预览:http://nextgenfocus.com/test1/
我想要这样的:http://foundation.zurb.com/
我知道把overflow: hidden
放在我的html
上,问题就解决了,但我丢失了滚动条。。。你有解决方案吗?
问题是因为您的菜单在包装器中。将你的侧菜单从包装中移出:点击此处查看
<div id="side-block">
<ul>
<li>
<a href="../." class="home active">Home</a>
</li>
<li>
<a href="../shop/shop.php" class="shop ">Shop</a>
</li>
<li>
<a href="../community/" class="forums">Community</a>
</li>
<li>
<a href="#" class="support ">Support</a>
</li>
</ul>
</div>
<div class="wrapper">
<span id="side-block-toggle-icon" title="Navigation"></span>
</div>
相关文章:
- 使用javascript(ajax,jquery?)从表中删除对象(用户等)
- 如果用户选择离开网页,如何删除记录
- 从 DOM 中删除/删除 Javascript 用户定义的数组
- 我想限制用户在jquery中输入文本后面的空格,如果它在文本后面,我会删除空格
- 在删除用户之前进行分析
- php使用ajax生成html表,以应用用户操作,如删除、更新和编辑
- 当我的响应菜单打开时,我如何删除用户转到侧面的功能
- 当用户向下滚动我的网页时,如何删除chrome地址栏周围的边框
- 如何阻止用户删除handontable中标题行中的单元格
- 检测用户是否没有't输入任何内容/删除输入jQuery
- 如何防止用户删除文本输入中的前三个字符
- 如果用户更改下拉选择,jQuery将删除单选按钮/输入选项
- 如何在提交时使用 Jquery 从文本输入框中删除用户输入
- 使用 http 删除终止用户会话
- 当用户删除对文本框的关注时的Javascript事件
- 我可以通过javascript使用上下文菜单检测用户删除吗
- 用户删除特定的子元素
- 为移动用户删除html5视频背景的最佳方法是什么?
- Firebase用户删除不起作用
- 让用户删除选定的fabric js对象