Reputation: 145
I'm a second year application developer student doing an internship at an IT company, and my supervisor asked me to make a dropdown menu that looks and functions exactly like the one found on http://www.veermanict.nl/ at the top when in Mobile mode (you have to resize your window to mobile resolution to see what I'm talking about).
I am a total rookie and I've been struggling with this for two days. JavaScript hasn't even been covered in my education so I'm basically winging everything here, Googling for knowledge. I found a template I can alter in CSS to make it look more like what my supervisor wants, but the problem is that I can't seem to make it work.
I'm talking about this script: http://codepen.io/pedronauck/pen/fcaDw
I tried making an HTML document and linking the CSS and JavaScript to the HTML page like this:
<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>
... But it will simply show up as: prntscr (dot) com/8dxk4s (I'm not allowed multiple links, sorry)
So that means the CSS does work. But the Javascript doesn't? There are also errors inside of the CSS in Dreamweaver, as far as I can see. And isn't the JavaScript missing a semicolon at rule 25?
Please help me out. I don't want my supervisor to think I'm useless. But I'm stuck on this and he's too busy to help me out. I've tried a dozen of other options but he doesn't settle for mediocre.
Upvotes: 0
Views: 73
Reputation: 2036
Converted CSS
from SCSS
Use this 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);
}
}
Upvotes: 1
Reputation:
You're using SCSS (Sass) code as if it's raw CSS. In the Codepen you provided it begins working immediately by changing CSS to SCSS.
Upvotes: 1
Reputation:
The language property for the script tag is deprecated. Use type, not both. Or just not use it at all. The default value is for type is text/javascript on all modern web browsers.
Upvotes: 0