Notice: Undefined variable: root in /users/basti1012/www/index1.php on line 41
Navigation einer Webseite mit JavaScript

Navigation einer Webseite mit JavaScript

Hallo, ich mache gerade eine Webseite und möchte das diese auch auf dem Handy gut funktioniert. Jetzt will ich das ab einer bestimmten Bildschirmauflösung man auf den Menü Icon klickt und von rechts das Menü kommt. Vielleicht kann mir hier jemand helfen, die Sachen die ich im Internet finde verwirren mich nur.

Der hier verwendete Code

<html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0"/> <title>Schreinerei Brettner | Startseite</title> <style> body { margin:0; padding:0; width:100%; height: auto; background-size: cover; background-image: url(http://www.foto-schweiz.com/hintergrundbilder/hintergrundbild_21_1280x1024.jpg); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; } #wrapper{ display:flex; flex-direction:column; } header{ display:flex; flex-direction:row; background-color:#FAEDD6; height:70px; } #logo{ flex:1; } #mittemenue{ display:flex; flex:2; width:80%; margin-left:200px; margin-right:200px; font-size:1em; } #slidemenue{ flex:0; } .header img { width: 192px; height:70px; position: absolute; } .header ul { margin: auto; width: 89%; padding:17px 0 23px 0; text-align: center; } .header ul li { display: inline; font-family: 'Jura', sans-serif; font-size: 152%; padding: 0 27px; } .header ul li a { text-decoration: none; color: black; } .header ul li a:hover { border-bottom: 4px solid #78342f; } .header ul li a.active { border-bottom: 4px solid #78342f; } main{ height:500px; display:flex; flex-direction:row; } .asidelinks{ height:100%; flex:1; overflow:auto; padding:1px 10px 0px 10px; } .asiderechts{ height:100%; flex:1; overflow:auto; padding:1px 10px 0px 10px; } #content{ flex:3; height:100%; overflow:auto; padding:5px 50px -2px 50px; } h1{ text-align:center; text-decoration:underline; } footer { background-color: #FAEDD6; height: 42px; width: 100%; color: #151515; font-family: 'Roboto', sans-serif; margin:0px auto auto 0px; letter-spacing: 0.5px; } .footerlinks{ margin-left:50px; margin-top:10px; line-height:40px; } @media screen and (min-width:850px){ .header ul { display: block !important; } #menu,#X,#dunkel,#togg{ display:none; } } @media screen and (max-width: 850px){ #menu{ display:none; height:100%; margin-left:-200px; width:200px; background:#123456; position:fixed; z-index:4; right:0 } #X{ position:absolute; right:180px; top:0px; cursor:pointer; color:white; } .header #togg{ position:absolute; right:0; top:0px; width:40px; height:40px; } #dunkel{ width:100vw; height:100vh; position:fixed; top:0; left:0; z-index:3; background:black; opacity:0.5; display:none; } } </style> <link href="https://fonts.googleapis.com/css?family=Jura" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet"> <style> </style> </head> <body> <div id="wrapper"> <header> <div class="header"><div id="logo"> </div> <div id="mittemenue"> <ul id="menu"><span id="X">X</span> <li><a class="active" href="">Startseite</a></li> <li><a href="">Über uns</a></li> <li><a href="">Leistungen</a></li> <li><a href="">Kontakt</a></li> </ul> </div> <div id="slidemenu"> <img id="togg" src="https://www.megabitesfishing.co.nz/uploads/shared/images/art/Mobile_Icons/menuA.png"> </div> </header> <main> <aside class="asidelinks"><h1>Navigation</h1><p> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer </p></aside> <div id="content"> <h1>LoremIpsum Bla Blub Basti1012</h1> <p> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer </p> </div> <aside class="asiderechts"> <h1>Infothek</h1> <p> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer </p></aside> <main> </div> <footer> <span class="footerlinks"><a class="copyright">&copy;</a> Copyright 2018 - Schreinerei Brettner <a class="strich"> | </a> <a class="impressum" href="impressum.html">Impressum</a> </span> </footer> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script> $('#togg').click(function(){ $('#menu').fadeIn() }); $('#X').click(function(){ $('#dunkel').css('display','none'); $('#menu').fadeOut(); }) $('#togg').click(function(){ $('#dunkel').css('display','block'); }) </script> <div id="dunkel"></div> </div> </body> </html>