简体   繁体   English

在Firefox中失败

[英]Fail in Firefox

Hi i want to put this code in my website, but when i try to click on the menu button in Firefox it pops up then the background changes from the normal color to white (or is gone). 嗨,我想将此代码放到我的网站中,但是当我尝试单击Firefox中的菜单按钮时,它会弹出,然后背景从正常颜色变为白色(或消失)。

http://jsfiddle.net/Xroad/3pn2pkt6/19/ http://jsfiddle.net/Xroad/3pn2pkt6/19/

 $('.toggle-menu').click(function (e) { e.preventDefault(); $('h4.toggle-menu').text($(this).text() == 'Menu' ? 'Close' : 'Menu'); $('.circle').toggleClass('Opacity'); $('#overlay-menu').delay(5000).toggleClass('Opacity'); $('.circle').toggleClass('open'); }); 
 html, body { height: 100%; } body { background: #fffdee; } .circle { position: fixed; top: -50%; left: -50%; height: 50%; width: 50%; border-radius: 50%; background: #98694d; opacity: 0; -webkit-transition-duration: 0.5s; -webkit-transition-property: all; -webkit-transition-timing-function: ease-in-out; transition: all 0.5s ease-in-out; z-index: 1; } .open { top: -50%; left: -50%; width: 200%; height: 200%; } #overlay-menu { position: fixed; top: 0; left: 0; height: 100%; width: 100%; text-align: center; color: black; opacity: 0; z-index: 4; } h4.toggle-menu { position: fixed; top: 20px; right: 70px; color: black; cursor: pointer; z-index: 5; } .Opacity { opacity: 1 !important; visibility: visible; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="circle"></div> <nav id="home-menu" class="menu"> <h4 class="toggle-menu">Menu</h4> </nav> <div id="overlay-menu"><p>MY CONTENT</p></div> 

This works: (small change in the .open-class (added the opacity to it)), and removal of one line in the JS. 这行得通:(。open类的微小变化(为其增加了不透明度)),并在JS中删除了一行。 Tested in Firefox and Chrome 在Firefox和Chrome中测试

 $('.toggle-menu').click(function (e) { e.preventDefault(); $('h4.toggle-menu').text($(this).text() == 'Menu' ? 'Close' : 'Menu'); //$('.circle').toggleClass('Opacity'); $('#overlay-menu').delay(5000).toggleClass('Opacity'); $('.circle').toggleClass('open'); }); 
 html, body { height: 100%; } body { background: #fffdee; } .circle { position: fixed; top: -50%; left: -50%; height: 50%; width: 50%; border-radius: 50%; background: #98694d; opacity: 0; -webkit-transition-duration: 0.5s; -webkit-transition-property: all; -webkit-transition-timing-function: ease-in-out; transition: all 0.5s ease-in-out; z-index: 1; } .open { top: -50%; left: -50%; width: 200%; height: 200%; opacity: 1; } #overlay-menu { position: fixed; top: 0; left: 0; height: 100%; width: 100%; text-align: center; color: black; opacity: 0; z-index: 4; } h4.toggle-menu { position: fixed; top: 20px; right: 70px; color: black; cursor: pointer; z-index: 5; } .Opacity { opacity: 1 !important; visibility: visible; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="circle"></div> <nav id="home-menu" class="menu"> <h4 class="toggle-menu">Menu</h4> </nav> <div id="overlay-menu"><p>MY CONTENT</p></div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM