forked from rebillar/site-accueil-insa
ptit menu mobile qui marche
This commit is contained in:
parent
312598ea1b
commit
5bb031d388
4 changed files with 117 additions and 131 deletions
|
@ -1,12 +1,11 @@
|
||||||
.menu {
|
.menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
|
||||||
bottom: -12vh;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 25vh;
|
height: fit-content;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
transition: transform 0.3s;
|
transition: transform 0.3s;
|
||||||
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +20,6 @@
|
||||||
height: auto;
|
height: auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: rgba(64, 98, 63, 0.7); /* Add a semi-transparent background color for readability */
|
background-color: rgba(64, 98, 63, 0.7); /* Add a semi-transparent background color for readability */
|
||||||
bottom: 5vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,12 +33,13 @@ margin: 0 10px;
|
||||||
#menu a {
|
#menu a {
|
||||||
display: block; /* Add this line to make the link fill the entire menu item */
|
display: block; /* Add this line to make the link fill the entire menu item */
|
||||||
padding: 10px; /* Add some padding for better readability and clickable area */
|
padding: 10px; /* Add some padding for better readability and clickable area */
|
||||||
color: #c25151;
|
color: #c32c2c;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-image: url('/assets/img/buisson.svg'); /* Add this line to set the link background image */
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
background-image: url('/assets/img/buisson.svg');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu a:hover{
|
#menu a:hover{
|
||||||
|
@ -48,99 +47,70 @@ margin: 0 10px;
|
||||||
transform: translateY(-2px);
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*hide the mobile menu by default*/
|
||||||
|
|
||||||
|
.topnav{
|
||||||
|
visibility: hidden;
|
||||||
|
height: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Add styles for smartphones screens */
|
/* Add styles for smartphones screens */
|
||||||
@media all and (max-width: 800px) {
|
@media all and (max-width: 800px) {
|
||||||
.menu {
|
/* Style the navigation menu */
|
||||||
|
.topnav {
|
||||||
|
visibility: visible;
|
||||||
|
overflow-y: scroll;
|
||||||
|
background-color: #333;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 25vh;
|
z-index: 100;
|
||||||
z-index: 2;
|
border-radius: 10px;
|
||||||
overflow: visible;
|
margin-top: 1vh;
|
||||||
transition: transform 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu ul {
|
|
||||||
height: auto;
|
height: auto;
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu li {
|
/* Hide the links inside the navigation menu (except for logo/home) */
|
||||||
margin: 5px 0;
|
.topnav #mobile_menu_links {
|
||||||
}
|
display: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-menu {
|
/* Style navigation menu links */
|
||||||
|
.topnav a {
|
||||||
|
color: white;
|
||||||
|
padding: 1vh 1vw;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 4vh;
|
||||||
display: block;
|
display: block;
|
||||||
position: fixed;
|
text-align: center;
|
||||||
top: 0; left: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 20;
|
|
||||||
|
|
||||||
height: 0;
|
|
||||||
background: rgba(15, 15, 23, 0);
|
|
||||||
|
|
||||||
transition: background-color 0.2s linear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-menu .containerF3g {
|
/* Style the hamburger menu */
|
||||||
width: 100%; height: 100%;
|
.topnav a.icon {
|
||||||
overflow: auto;
|
background: black;
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-grid {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 2vh 60px;
|
|
||||||
min-height: 100vh;
|
|
||||||
justify-content: center;
|
|
||||||
align-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-menu-link {
|
|
||||||
min-width: 100px;
|
|
||||||
width: 50%;
|
|
||||||
display: block;
|
|
||||||
opacity: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
transform: translateY(10%);
|
|
||||||
transition: transform 0.2s ease-out, opacity 0.2s linear 0.05s;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav.mobile-menu.open .mobile-menu-link {
|
|
||||||
transform: translateY(0);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-link:hover text {
|
|
||||||
fill: #FFDC00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-brick {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
span.close-mobile-menu {
|
|
||||||
color: #FFF;
|
|
||||||
font-size: 80px;
|
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
-webkit-user-select: none; /* Safari */
|
right: 0;
|
||||||
-moz-user-select: none; /* Firefox */
|
top: 0;
|
||||||
-ms-user-select: none; /* IE10+/Edge */
|
|
||||||
user-select: none; /* Standard */
|
|
||||||
cursor: pointer;
|
|
||||||
bottom: 0;
|
|
||||||
right: 20px;
|
|
||||||
transition: color 0.5s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span.close-mobile-menu:hover {
|
/* Add a grey background color on mouse-over */
|
||||||
color: #FFDC00;
|
.topnav a:hover {
|
||||||
|
background-color: #ddd;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
background-color: rgb(27, 170, 22);;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,20 @@ a.linkmail:hover {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
ajoute une petite marge au dessus de la pancarte sur mobile pour laisser
|
||||||
|
de la place a la navbar
|
||||||
|
|
||||||
|
ajuste aussi la taille du texte de la pancarte
|
||||||
|
*/
|
||||||
|
@media all and (max-width: 800px) {
|
||||||
|
|
||||||
|
.pancarte{
|
||||||
|
margin-top: 10vh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.pancarte .title {
|
.pancarte .title {
|
||||||
padding: 3vw 4.5vw;
|
padding: 3vw 4.5vw;
|
||||||
color: black;
|
color: black;
|
||||||
|
@ -171,6 +185,8 @@ footer {
|
||||||
margin-top: 2vh;
|
margin-top: 2vh;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
font-size: 3vh;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,39 +29,45 @@ for($i = 0; $i <= 17; $i++){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Sur téléphone -->
|
<!-- librairie d'icones libres de droit font-awesome pour mettre le petit logo hamburger-->
|
||||||
<nav class="mobile-menu" id="mobile-menu">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
|
||||||
|
<!-- la barre de navigation -->
|
||||||
|
<div class="topnav">
|
||||||
|
<a href="/index.php" class="active">P'tit menu :)</a>
|
||||||
|
|
||||||
|
<!-- les liens (cachés par défaut) -->
|
||||||
|
<div id="mobile_menu_links">
|
||||||
|
|
||||||
<div class="containerF3g">
|
|
||||||
<div class="mobile-grid">
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
for($i = 0; $i <= 21; $i++) {
|
|
||||||
if($i%2 == 0) {
|
|
||||||
// pair
|
for($i = 0; $i <= 17; $i++){
|
||||||
$link = $lien_y_0[$i/2];
|
|
||||||
$text = $texte_y_0[$i/2];
|
|
||||||
} else {
|
echo "<a href=\"".$SITE_MAP[$i][0]."\">".$SITE_MAP[$i][1]."</a>";
|
||||||
//impair
|
|
||||||
$link = $lien_y_1[($i-1)/2];
|
|
||||||
$text = $texte_y_1[($i-1)/2];
|
|
||||||
}
|
|
||||||
echo
|
|
||||||
'<a href="'.$link.'" class="mobile-menu-link">
|
|
||||||
<svg class="mobile-brick menu-link" viewBox="-2 -2 51 21">
|
|
||||||
<use xlink:href="#Brick" width="47" height="17" x="0" y="0"/>
|
|
||||||
<text x="23.8" y="8.5">
|
|
||||||
'.$text.'
|
|
||||||
</text>
|
|
||||||
</svg>
|
|
||||||
</a>';
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- appelle la fonction de changement d'etat du menu quand cliqué -->
|
||||||
|
<a href="javascript:void(0);" class="icon" onclick="toggle_mobile_menu()">
|
||||||
|
<i class="fa fa-bars"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span id="close-mobile-menu" class="close-mobile-menu">
|
|
||||||
x
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</nav>
|
<script>
|
||||||
|
/* Change l'etat entre visible et non visible du menu déroulant */
|
||||||
|
function toggle_mobile_menu() {
|
||||||
|
var x = document.getElementById("mobile_menu_links");
|
||||||
|
if (x.style.display === "block") {
|
||||||
|
x.style.display = "none";
|
||||||
|
} else {
|
||||||
|
x.style.display = "block";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -23,12 +23,6 @@ header("Cache-Control: no-cache, must-revalidate");
|
||||||
<link rel = "shortcut icon" href = "<?= $relativepath ?>assets/img/ico_promo_60.ico" >
|
<link rel = "shortcut icon" href = "<?= $relativepath ?>assets/img/ico_promo_60.ico" >
|
||||||
|
|
||||||
|
|
||||||
<!-- EDIT : la police (modifiée) est host dans assets/fonts/*.otf, et définie dans assets/css/template.css il n'y a plus besoin de la charger depuis cdnfonts -->
|
|
||||||
<!-- ICI C'EST LA POLICE QU'IL FAUDRA CHANGER SUIVANT LE THEME, il faudra penser à modifier le fichier css car ici on importe seulement la police mais dans le css on l'attribut au texte -->
|
|
||||||
<!--link href="http://fonts.cdnfonts.com/css/new-super-mario-font-u" rel="stylesheet"-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<title><?= $pagetitle ?> | INSAT Accueil</title>
|
<title><?= $pagetitle ?> | INSAT Accueil</title>
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +54,7 @@ header("Cache-Control: no-cache, must-revalidate");
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($txt_pancarte)){
|
if(isset($txt_pancarte) && $txt_pancarte != ""){
|
||||||
|
|
||||||
echo "<div class=\"pc_container\">
|
echo "<div class=\"pc_container\">
|
||||||
<div class=\"pancarte\">
|
<div class=\"pancarte\">
|
||||||
|
|
Loading…
Reference in a new issue