为什么这个简单的代码不起作用?

时间:2015-12-19 11:42:34

标签: html css

我试图让我的所有菜单位置都正确而不是离开。我有一个用CSS和HTML制作的菜单。我想将菜单和按钮向右移动而不是向左移动。我该怎么办?



* {
  margin: 0;
  padding: 0;
}
body {
  font-family: Arial, sans-serif;
  overflow-x: hidden;
}
nav {
  position: fixed;
  z-index: 1000;
  top: 0;
  bottom: 0;
  width: 200px;
  background-image: url(background.jpg);
  transform: translate3d(-200px, 0, 0);
  transition: transform 0.4s ease;
}
.active-nav nav {
  transform: translate3d(0, 0, 0);
}
nav ul {
  list-style: none;
  margin-top: 100px;
}
nav ul li a {
  text-decoration: none;
  display: block;
  text-align: center;
  color: #0094ff;
  padding: 10px 0;
}
.nav-toggle-btn {
  display: block;
  position: absolute;
  left: 200px;
  width: 40px;
  height: 40px;
  background-image: url(menunohover.jpg);
}
.nav-toggle-btn:hover {
  background-image: url(menuhover.jpg);
}
.content {
  padding-top: 200px;
  height: 755px;
  width: auto;
  background: url(backgroundall.jpg) no-repeat;
  transition: transform 0.4s ease;
  text-align: center;
}
.active-nav .content {
  transform: translate3d(200px, 0, 0);
}

<!DOCTYPE html>

<html lang="en">

<head>
  <meta charset="utf-8" />
  <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
</head>

<body>

  <nav>
    <a href="#" class="nav-toggle-btn"></a>
    <ul>
      <li><a href="http://fxp.co.il" target="_blank">בסיס</a>
      </li>
      <li><a href="#">חנות</a>
      </li>
      <li><a href="#">ספינות</a>
      </li>
      <li><a href="#">בזיזה</a>
      </li>
    </ul>
  </nav>

  <div class="content">
    <h1>סוף סוף</h1>
  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  <script type="text/javascript">
    (function() {

      var bodyEl = $('body'),
        navToggleBtn = bodyEl.find('.nav-toggle-btn');

      navToggleBtn.on('click', function(e) {
        bodyEl.toggleClass('active-nav');
        e.preventDefault();
      });
    })();
  </script>

</body>

</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案