菜单在Android Chrome上无效

时间:2015-03-02 14:48:03

标签: javascript android jquery google-chrome

我为自己的个人作品集创建了一个全屏叠加菜单。它在桌面上的Chrome / FF / IE和Galaxy S4上的常规Android浏览器上运行得非常好。但是,我无法让它在Chrome for Android上运行。好像jQuery只是没有在浏览器中切换。

以下代码。 JSFiddle here。实例here

HTML:

  <div class="button-container" id="toggle">
    <span class="top"></span>
    <span class="middle"></span>
    <span class="bottom"></span>
  </div>
  <div class="overlay" id="overlay">
    <nav class="overlay-menu">
      <ul>
        <li><a href="index.php">Home</a></li>
        <li><a href="about.php">About</a></li>
        <li><a href="portfolio.php">Portfolio</a></li>
        <li><a href="resume.php">Resume</a></li>
        <li><a href="contact.php">Contact</a></li>
      </ul>
    </nav>
  </div>

JS:

$(document).ready(function(){
  $("#toggle").on('click touchstart', function(event) {
   event.preventdefault();
   $("#overlay").toggleClass("open")
   });
});

CSS:

.overlay {
    position: fixed;
    background: #FF5252;;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    -webkit-transition: opacity .35s, visibility .35s, width .35s ease-in-out;
            transition: opacity .35s, visibility .35s, width .35s ease-in-out; 
    overflow: hidden;
    z-index: 100;
}

.overlay.open {
    opacity: .9;
    visibility: visible;
    width: 100%;
}

.overlay nav {
    position: relative;
    height: 60%;
    top: 50%;
    -webkit-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
            transform: translateY(-50%);
    font-size: 32px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    text-align: center;
}

.overlay nav ul {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    display: inline-block;
    position: relative;
    height: 100%; 
}

.overlay nav ul li {
    display: block;
    height: 20%;
    height: -webkit-calc(100% / 5);
    height: calc(100% / 5);
    min-height: 32px;
    position: relative;
    opacity: 0;
}

.overlay.open nav ul li {
    -webkit-animation: menuFade .5s ease forwards;
    animation: menuFade .5s ease forwards;
    -webkit-animation-delay: .35s;
    animation-delay: .35s;
}

.overlay.open nav ul li:nth-of-type(2) {
    -webkit-animation-delay: .4s;
    animation-delay: .4s;
}

.overlay.open nav ul li:nth-of-type(3) {
    -webkit-animation-delay: .45s;
    animation-delay: .45s;
}

.overlay.open nav ul li:nth-of-type(4) {
    -webkit-animation-delay: .5s;
    animation-delay: .5s;
}

.overlay.open nav ul li:nth-of-type(5) {
    -webkit-animation-delay: .55s;
    animation-delay: .55s;
}

@-webkit-keyframes menuFade {
    0% {
        opacity: 0;
        left: -25%;
    }
    100% {
        opacity: 1;
        left: 0;
    }
}

@keyframes menuFade {
    0% {
        opacity: 0;
        left: -25%;
    }
    100% {
        opacity: 1;
        left: 0;
    }
}

.overlay nav ul li a {
    display: block;
    position: relative;
    color: #FFF;
    overflow: hidden;
}

.overlay nav ul li a:hover {
    text-decoration: none;
}

.overlay nav ul li a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0%;
    -webkit-transform: translateX(-105%);
    -ms-transform: translateX(-105%);
        transform: translateX(-105%);
    height: 3px;
    width: 100%;
    background: #FFF;
    -webkit-transition: .35s ease;
            transition: .35s ease;
}

.overlay nav ul li a:hover:after {
    -webkit-transform: translateX(0%);
    -ms-transform: translateX(0%);
        transform: translateX(0%);
}

1 个答案:

答案 0 :(得分:0)

问题解决了。我的手机缓存了旧版本的JS文件,该文件没有使用新菜单。清除缓存解决了所有问题。