A Pen by Bruno Rafael on CodePen.
Last active
May 13, 2016 15:56
-
-
Save brunorafaeI/ed5f23c2b9e5bca6f4ce18bc85c6d91c to your computer and use it in GitHub Desktop.
com'on menu fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<!-- //http://www.alsacreations.com/tuto/liste/5-javascript.html --> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Com'on - Association de Saint-Nazaire</title> | |
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<header> | |
<div class="contact-top"> | |
<p>02 40 66 11 78</p> | |
<p>panonazaire@orange.fr</p> | |
</div> | |
<div class="logo"><a href="#"><img src="http://www.com-on.be/templates/comon_2015/images/logo.png" alt="Com'on st-nazaire" width="60%" height="60%" /></a></div> | |
</header> | |
<nav class="navigation"> | |
<ul> | |
<li><a href="#">Accueil</a></li> | |
<li><a href="#">Nos Services</a></li> | |
<li><a href="#">Commander</a></li> | |
<li><a href="#">Contact</a></li> | |
<li><a href="#">À propos</a></li> | |
</ul> | |
</nav> | |
<section> | |
<article> | |
<title> | |
Nouveautés | |
</title> | |
<div class="img-article"><a href="#"><img src="http://www.pano-group.com/wp-content/uploads/2014/01/portrait-St%C3%A9phane-Danilo1.jpg" alt="" width="40%" height="40%" /></a></div> | |
<h1>Nouveautés</h1> | |
<p>Contenu des nouveautés</p> | |
</article> | |
<article> | |
<title> | |
Commander | |
</title> | |
<h1>Commander</h1> | |
<p>contenu de la commande</p> | |
</article> | |
</section> | |
<aside> | |
<title> | |
Nos Clients | |
</title> | |
</aside> | |
<footer> | |
<p>Com'on Association de pano boutique - Saint-Nazaire Corpyright 2016 <br/>115, Avenue de la République - 44600 Saint-Nazaire France</p> | |
<p></p> | |
</footer> | |
<h1>Browser Information</h1> | |
<p id="name"></p> | |
</script> | |
<p id="version"></p> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ $(window).scroll(function () { | |
//Au scroll dans la fenetre on déclenche la fonction | |
if ($(this).scrollTop() > 80) { | |
//si on a défilé de plus de 150px du haut vers le bas | |
$('nav').addClass("fixNav"); //on ajoute la classe "fixNavigation" à <div id="navigation"> | |
} else { $('nav').removeClass("fixNav"); | |
//sinon on retire la classe "fixNavigation" à <div id="navigation"> | |
} }); }); | |
window.onscroll = changePos; | |
function changePos() { | |
var header = document.getElementById("header"); | |
if (window.pageYOffset > 80) { | |
header.style.position = "fixed"; | |
header.style.top = pageYOffset + "px"; | |
} else { | |
header.style.position = ""; | |
header.style.top = ""; | |
} | |
} | |
var browser = $.uaMatch(navigator.userAgent).browser; | |
$('p[id="name"]').html("Browser Name: <span>"+browser+"</span>"); | |
$('p[id="version"]').html("Version Number: <span>"+$.browser.version+"</span>"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* {margin:0px; padding:0px; overflow-x:none; font-family: Verdana,sans-serif;} | |
html, body { | |
height:100%; | |
background: url(http://www.communide.fr/medias/files/blue-yellow-bokeh-circles-desktop-wallpaper.jpg) no-repeat center center fixed; | |
background-size: cover; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
} | |
main{ | |
position:relative; | |
min-height:100%; | |
max-width:99%; | |
} | |
header { | |
height:3.5em; | |
background:rgba(255,255,255, 0.9); | |
padding:20px; | |
box-shadow: 0px 0px 20px 1px rgba(0,0,0, 0.8) inset; | |
} | |
.logo{ | |
float:left; | |
left: 1.5em; | |
} | |
.contact-top { | |
float:right; | |
text-align:right; | |
font-size:0.9em; | |
} | |
nav { | |
float:left; | |
height:50px; | |
width:100%; | |
background:rgba(0,0,0, 0.7); | |
} | |
.fixNav { | |
z-index: 9999; | |
position: fixed; | |
top:0px; | |
} | |
nav ul { | |
list-style:none; | |
display:block; | |
margin-left:40%; | |
} | |
nav ul li { | |
display:inline; | |
} | |
nav ul li a { | |
float:left; | |
text-decoration:none; | |
font-size:0.9em; | |
line-height:1.5; | |
font-weight:bold; | |
color: rgba(255,128,25, 0.9); | |
border-bottom: 0px solid rgba(0,0,0, 0); | |
transition: border 0.6s; | |
padding:18px 12px 0px 12px; | |
} | |
nav ul li a:hover{ | |
color:rgba(255,255,255, 0.9); | |
border-bottom:4px solid rgba(255,128,25, 1); | |
transition: border 0.4s; | |
} | |
section{ | |
position:absolute; | |
background-color: rgba(153,0,52, 0.9); | |
margin:5em 2em; | |
width:60%; | |
height:95%; | |
border-radius: 0px 10px 10px 0px; | |
} | |
section article { | |
margin:12px; | |
padding:8px; | |
border:1px dashed rgba(255,255,255, 1); | |
border-radius: 0px 10px; | |
} | |
.img-article { | |
float:left; | |
} | |
aside { | |
position:absolute; | |
margin:5em 2em; | |
width: 30%; | |
height:95%; | |
right:0; | |
background-color: rgba(204,165,20, 0.8); | |
border-radius: 10px 0px 0px 10px; | |
} | |
footer { | |
position:fixed; | |
width:99%; | |
height:2em; | |
bottom:0px; | |
text-align:center; | |
color: rgb(50,50,50); | |
font-size:0.8em; | |
background-color: rgba(255,255,255, 0.8); | |
padding:0.6em; | |
} | |
A Pen by Bruno Rafael on CodePen.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment