繁体   English   中英

无法使这些脚本协同工作

[英]Can't get these scripts to work together

我是应用程序开发人员的二年级学生,在一家IT公司实习,我的主管要求我制作一个下拉菜单,其外观和功能与顶部http://www.veermanict.nl/上的菜单完全相同。在移动模式下(您必须将窗口大小调整为移动分辨率才能查看我在说什么)。

我是一个新手,我已经为此苦苦挣扎了两天。 我的学业甚至没有涵盖JavaScript,因此我基本上在这里介绍所有内容,包括搜索知识。 我发现可以在CSS中进行更改的模板,使其看起来更像我的主管想要的,但是问题是我似乎无法使其正常工作。

我正在谈论这个脚本: http : //codepen.io/pedronauck/pen/fcaDw

我尝试制作一个HTML文档,并将CSS和JavaScript链接到HTML页面,如下所示:

 <head> <meta charset="utf-8"> <title>Menu Test 2</title> <link rel="stylesheet" type="text/css" href="style2.css"> <script language="javascript" type="text/javascript" src="jquery-1.11.3.min.js"></script> <script language="javascript" type="text/javascript" src="dropdown.js"></script> </head> 

...但是它只会显示为:prntscr(点)com / 8dxk4s(不允许我使用多个链接,对不起)

因此,这意味着CSS确实可以工作。 但是Javascript不是吗? 据我所知,Dreamweaver中的CSS内部也存在错误。 JavaScript是否在规则25中缺少分号?

请帮帮我。 我不想让我的主管认为我没用。 但是我一直坚持下去,他太忙了,无法帮助我。 我尝试了许多其他选择,但他并不满足于平庸。

SCSS转换的CSS使用此CSS

的CSS

@import url("http://fonts.googleapis.com/css?family=Lato:300,400,700,900");
@import url(http://fonts.googleapis.com/css?family=Pacifico);
body {
  font-family: "Lato", Helvetica, Arial;
  font-size: 16px;
}

.text-center {
  text-align: center;
}

*, *:before, *:after {
  -webkit-border-sizing: border-box;
  -moz-border-sizing: border-box;
  border-sizing: border-box;
}

.container {
  width: 350px;
  margin: 50px auto;
}

.container > ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.title {
  font-family: 'Pacifico';
  font-weight: norma;
  font-size: 40px;
  text-align: center;
  line-height: 1.4;
  color: #2980B9;
}

.dropdown a {
  text-decoration: none;
}

.dropdown [data-toggle="dropdown"] {
  position: relative;
  display: block;
  color: white;
  background: #2980B9;
  box-shadow: 0 1px 0 #409ad5 inset, 0 -1px 0 #20638f inset;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
  padding: 10px;
}

.dropdown [data-toggle="dropdown"]:hover {
  background: #2c89c6;
}

.dropdown .icon-arrow {
  position: absolute;
  display: block;
  font-size: 0.7em;
  color: #fff;
  top: 14px;
  right: 10px;
}

.dropdown .icon-arrow.open {
  transform: rotate(-180deg);
  transition: transform 0.6s;
}

.dropdown .icon-arrow.close {
  transform: rotate(0deg);
  transition: transform 0.6s;
}

.dropdown .icon-arrow:before {
  content: '\25BC';
}

.dropdown .dropdown-menu {
  max-height: 0;
  overflow: hidden;
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown .dropdown-menu li {
  padding: 0;
}

.dropdown .dropdown-menu li a {
  display: block;
  color: #6e6e6e;
  background: #EEE;
  box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
  text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
  padding: 10px 10px;
}

.dropdown .dropdown-menu li a:hover {
  background: #f6f6f6;
}

.dropdown .show, .dropdown .hide {
  transform-origin: 50%, 0%;
}

.dropdown .show {
  display: block;
  max-height: 9999px;
  transform: scaleY(1);
  animation: showAnimation 0.5s ease-in-out;
  -moz-animation: showAnimation 0.5s ease-in-out;
  -webkit-animation: showAnimation 0.5s ease-in-out;
  transition: max-height 1s ease-in-out;
}

.dropdown .hide {
  max-height: 0;
  transform: scaleY(0);
  animation: hideAnimation 0.4s ease-out;
  -moz-animation: hideAnimation 0.4s ease-out;
  -webkit-animation: hideAnimation 0.4s ease-out;
  transition: max-height 0.6s ease-out;
}

@keyframes showAnimation {
  0% {
    transform: scaleY(0.1);
  }
  40% {
    transform: scaleY(1.04);
  }
  60% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.04);
  }
  100% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.02);
  }
  100% {
    transform: scaleY(1);
  }
}

@-moz-keyframes showAnimation {
  0% {
    transform: scaleY(0.1);
  }
  40% {
    transform: scaleY(1.04);
  }
  60% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.04);
  }
  100% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.02);
  }
  100% {
    transform: scaleY(1);
  }
}

@-webkit-keyframes showAnimation {
  0% {
    transform: scaleY(0.1);
  }
  40% {
    transform: scaleY(1.04);
  }
  60% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.04);
  }
  100% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.02);
  }
  100% {
    transform: scaleY(1);
  }
}

@keyframes hideAnimation {
  0% {
    transform: scaleY(1);
  }
  60% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.02);
  }
  100% {
    transform: scaleY(0);
  }
}

@-moz-keyframes hideAnimation {
  0% {
    transform: scaleY(1);
  }
  60% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.02);
  }
  100% {
    transform: scaleY(0);
  }
}

@-webkit-keyframes hideAnimation {
  0% {
    transform: scaleY(1);
  }
  60% {
    transform: scaleY(0.98);
  }
  80% {
    transform: scaleY(1.02);
  }
  100% {
    transform: scaleY(0);
  }
}

您正在使用SCSS(Sass)代码,就像原始CSS一样。 在您提供的Codepen中,通过将CSS更改为SCSS,它可以立即开始工作。

script标签的language属性已弃用。 使用类型,不能同时使用。 或者根本不使用它。 在所有现代网络浏览器上,类型的默认值为text / javascript。

暂无
暂无

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

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