javascript - menu wont show or work -
my menu on page not work, not @ visible. set on codepen works fine when have tried implement it, failed work. it? still new coding appreciate help.
html:
<body> <nav class="menu-opener"> <div class="menu-opener-inner"></div> </nav> <nav class="menu"> <ul class="menu-inner"> <a href="#" class="menu-link"> <li>home.</li> </a> <a href="#" class="menu-link"> <li>portfolio.</li> </a> <a href="#" class="menu-link"> <li>about.</li> </a> <a href="#" class="menu-link"> <li>contact.</li> </a> </ul> </nav> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript"> $(".menu-opener").click(function(){ $(".menu-opener, .menu-opener-inner, .menu").toggleclass("active"); }); </script> <div class="hero1"> <div id="hero1title"><h1>simplicity, craft , format <br>is excites me designer</h1></div> </div> </body>
css:
html,body { padding:0; margin:0; height:100% } body { overflow:hidden } /*--homepage*/ p.footertext { position:absolute; left:20px; bottom:10px; font-size:12px; z-index:1 } @media screen , (max-width : 400px) { p.footertext { display:none } } .hero1{ position: absolute; top: 0; left: 0; width: 100%; height:100%; background-color: rgb(247,200,198); } div #hero1title h1{ color: white; font-size: 90pt; position: absolute; width: 100%; height: 100%; top: 30%; text-align: center; } /* menu styling*/ %transition { transition: 250ms all; } .menu-opener { background: none; cursor: pointer; height: 4rem; margin: 1rem; position: absolute; user-select: none; width: 4rem; } .menu-opener-inner { background: white; height: .5rem; margin-left: .75rem; margin-top: 1.75rem; width: 2.5rem; @extend %transition; &::before, &::after { background: white; content: ''; display: block; height: 8px; width: 2.5rem; @extend %transition; } &::before { transform: translatey(-.75rem); } &::after { transform: translatey(.25rem); } &.active { background: transparent; &::before { transform: translatey(0rem) rotate(-45deg); } &::after { transform: translatey(-.5rem) translatex(-0rem) rotate(45deg) } } } .menu { background: rgb(152, 211, 189); height: 100%; position: absolute; top: 0px; user-select: none; width: 0rem; z-index: -1; @extend %transition; &.active { width: 100%; @extend %transition; & .menu-link { color: white; } } } .menu-inner { display: block; flex-direction: row; height: 450px; list-style-type: none; margin-top: 15%; padding: 0; } .menu-link { color: transparent; display: flex; flex: 1 1 auto; font-size: 70px; font-family: 'calibre-semibold'; height: 25%; text-align: center; text-decoration: none; li { margin: auto; } }
i dropped fiddle, , find following things:
- the z-index shouldn't -1
- it's there. need highlight see it.
- the text styled horribly, doesn't great.
- your text color in menu-list set "transparent".
- your hrefs should inside "li" not outside.
Comments
Post a Comment