响应Nav Bug

时间:2014-01-30 20:59:12

标签: html css navigation responsive-design skeleton-css-boilerplate

我正在尝试使用基本的Skeleton网格系统的响应式导航插件(responsive-nav.com),由于某些原因而没有编辑响应式导航插件的js和一般css,我遇到导航问题最小化到navicon出现的区域。由于某种原因,链接会自动下拉,并且不会出现导航图标。它与容器有关吗?我试过没有容器div并仍然遇到问题请参见图片例如:

Full Sized Nav

Navicon Size

这是HTML:

<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>

    <!-- Basic Page Needs
  ================================================== -->
    <meta charset="utf-8">
    <title>Your Page Title Here :)</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Mobile Specific Metas
  ================================================== -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!-- CSS
  ================================================== -->
    <link rel="stylesheet" href="stylesheets/base.css">
    <link rel="stylesheet" href="stylesheets/skeleton.css">
    <link rel="stylesheet" href="stylesheets/layout.css">
    <script src="js/responsive-nav.js"></script>
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Favicons
    ================================================== -->
    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">

</head>
<body>



    <!-- Primary Page Layout
    ================================================== -->


<div class="band-nav">    

    <div class="container">

        <div class="sixteen columns">
         <nav class="nav-collapse">
      <ul>
        <li><a href="http://google.com">Home</a></li>
        <li><a href="http://google.com">About</a></li>
        <li><a href="http://google.com">Projects</a></li>
        <li><a href="http://google.com">Blog</a></li>
      </ul>
    </nav>

 </div>

</div>

</div>

<div class="band-content">

<div class="container">

        <div class="sixteen columns">
            <h1 class="remove-bottom" style="margin-top: 40px">Skeleton</h1>
            <h5>Version 1.2</h5>
            <hr />
        </div>
        <div class="one-third column">
            <h3>About Skeleton?</h3>
            <p>Skeleton is a small collection of well-organized CSS files that can help you rapidly develop sites that look beautiful at any size, be it a 17" laptop screen or an iPhone. It's based on a responsive grid, but also provides very basic CSS for typography, buttons, forms and media queries. Go ahead, resize this super basic page to see the grid in action.</p>
        </div>

    </div>

</div>

   <script>
      var navigation = responsiveNav(".nav-collapse", {
        animate: true,        // Boolean: Use CSS3 transitions, true or false
        transition: 250,      // Integer: Speed of the transition, in milliseconds
        label: "Menu",        // String: Label for the navigation toggle
        insert: "after",      // String: Insert the toggle before or after the navigation
        customToggle: "",     // Selector: Specify the ID of a custom toggle
        openPos: "relative",  // String: Position of the opened nav, relative or static
        jsClass: "js",        // String: 'JS enabled' class which is added to <html> el
        init: function(){},   // Function: Init callback
        open: function(){},   // Function: Open callback
        close: function(){}   // Function: Close callback
      });
    </script>
<!-- End Document
================================================== -->
</body>
</html>

CSS:

/*
* Skeleton V1.2
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 6/20/2012
*/

/* Table of Content
==================================================
    #Site Styles
    #Page Styles
    #Media Queries
    #Font-Face */

/* #Site Styles
================================================== */


/*! responsive-nav.js 1.0.25 by @viljamis */



.nav-collapse,
.nav-collapse * {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.nav-collapse,
.nav-collapse ul {
  list-style: none;
  width: 100%;
  float: left;
}

.nav-collapse li {
  float: left;
  width: 100%;
}

@media screen and (min-width: 40em) {
  .nav-collapse li {
    width: 25%;
    *width: 24.9%; /* IE7 Hack */
    _width: 19%; /* IE6 Hack */
  }
}

.nav-collapse a {
  color: #fff;
  text-decoration: none;
  width: 100%;
  background: #000;
  border-bottom: 1px solid white;
  padding: 0.7em 1em;
  float: left;
}

@media screen and (min-width: 40em) {
  .nav-collapse a {
    margin: 0;
    padding: 1em;
    float: left;
    text-align: center;
    border-bottom: 0;
    border-right: 1px solid white;
  }
}

.nav-collapse ul ul a {
  background: #ececec;
  padding-left: 2em;
}

@media screen and (min-width: 40em) {
  .nav-collapse ul ul a {
    display: none;
  }
}

.nav-toggle {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  width: 70px;
  height: 55px;
  float: right;
  text-indent: -9999px;
  overflow: hidden;
  background: #f4421a url("hamburger.gif") no-repeat 50% 33%;
}

@media screen and (-webkit-min-device-pixel-ratio: 1.3), screen and (min--moz-device-pixel-ratio: 1.3), screen and (-o-min-device-pixel-ratio: 2 / 1), screen and (min-device-pixel-ratio: 1.3), screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) {
  .nav-toggle {
    background-image: url("hamburger-retina.gif");
    -webkit-background-size: 100px 100px;
    -moz-background-size: 100px 100px;
    -o-background-size: 100px 100px;
    background-size: 100px 100px;
  }
}




/* #Page Styles
================================================== */

/* #Media Queries
================================================== */

    /* Smaller than standard 960 (devices and browsers) */
    @media only screen and (max-width: 959px) {}

    /* Tablet Portrait size to standard 960 (devices and browsers) */
    @media only screen and (min-width: 768px) and (max-width: 959px) {}

    /* All Mobile Sizes (devices and browser) */
    @media only screen and (max-width: 767px) {}

    /* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
    @media only screen and (min-width: 480px) and (max-width: 767px) {}

    /* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
    @media only screen and (max-width: 479px) {}


/* #Font-Face
================================================== */
/*  This is the proper syntax for an @font-face file
        Just create a "fonts" folder at the root,
        copy your FontName into code below and remove
        comment brackets */

/*  @font-face {
        font-family: 'FontName';
        src: url('../fonts/FontName.eot');
        src: url('../fonts/FontName.eot?iefix') format('eot'),
             url('../fonts/FontName.woff') format('woff'),
             url('../fonts/FontName.ttf') format('truetype'),
             url('../fonts/FontName.svg#webfontZam02nTh') format('svg');
        font-weight: normal;
        font-style: normal; }
*/

2 个答案:

答案 0 :(得分:1)

我想你忘了链接到jquery库。您只链接到响应式导航的jquery,但您需要使用Main jquery库。

将此链接放在responsive-nav.js的链接之前:

答案 1 :(得分:0)

我通过此参考获得了响应式导航错误:

<script src='https://cdnjs.cloudflare.com/ajax/libs/responsive-nav.js/1.0.32/responsive-nav.min.js'></script>

所以我必须下载它并将其托管在我的本地资源上:

<script src="/js/responsive-nav.min.js" type="text/javascript"></script>

问题解决了我。