Linkebel
posted this
29 November 2016

Hello,
Sue this site: http://www.workinprogress.blfacademie.be/
I put a sidebar with button that pushes the contents of the website
For this in the code below I put the different parts of the site in sections
<style>
/* The side navigation menu */
.sidenav2 {
height: 100%; /* 100% Full-height */
width: 0; /* 0 width - change this with JavaScript */
position: fixed; /* Stay in place */
z-index: 1; /* Stay on top */
top: 0;
right: 0;
background-color: #ffffff; /* Black*/
overflow-x: hidden; /* Disable horizontal scroll */
padding-top: 60px; /* Place content 60px from the top */
transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
border-left: 1px solid #E5E5E5;
}
/* The navigation menu links */
.sidenav2 a {
/*padding: 8px 8px 8px 32px;*/
text-decoration: none;
font-size: 13px;
color: #343434;
display: block;
transition: 0.3s;
text-indent: -13px;
padding-left: 10px;
}
/* When you mouse over the navigation links, change their color */
.sidenav2 a:hover, .offcanvas a:focus{
color: #818181;
}
.sidenav2 a:before {
content: "•";
padding-right: 8px;
/*color: #9e0e0e;*/
}
/* Position and style the close button (top right corner) */
.sidenav2 .closebtn2 {
position: absolute;
top: -4px;
right: 12px;
font-size: 36px;
margin-left: 50px;
}
/* Style page content - use this if you want to push the page content to the right when you open the side navigation */
#main2 {
transition: margin-right .5s;
}
/* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */
@media screen and (max-height: 450px) {
.sidenav2 {padding-top: 15px;}
.sidenav2 a {font-size: 18px;}
}
title {
display:block !important;
color: #9e0e0e;
text-align: center;
border-bottom: 1px solid;
margin-top: 20px;
margin-bottom: 10px;
}
</style>
<script>
/* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */
function openNav2() {
document.getElementById("mySidenav2").style.width = "250px";
document.getElementById("mySidenav2").style.left = "inherit";
document.getElementById("section3").style.marginRight = "250px";
document.getElementById("section6").style.marginRight = "250px";
document.getElementById("section2").style.marginRight = "250px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */
function closeNav2() {
document.getElementById("mySidenav2").style.width = "0";
document.getElementById("section3").style.marginRight = "0";
document.getElementById("section6").style.marginRight = "0";
document.getElementById("section2").style.marginRight = "0";
document.body.style.backgroundColor = "white";
}
</script>
<div id="mySidenav2" class="sidenav2">
<a href="javascript:void(0)" class="closebtn2" onclick="closeNav2()">×</a>
<br />
<div style="padding:0 20px;color:#343434;">
<center><?php
// afficher photo user
$user = wp_get_current_user()->ID;
$size = 100;
echo get_avatar( $user, $size );
?></center>
<br />
<strong>
<?php
$current_user = wp_get_current_user();
echo 'Bonjour ' . $current_user->display_name . '<br /><br />';
?>
</strong>
<?php dynamic_sidebar('area-3-widget-area'); ?>
</div>
</div>
<!-- Use any element to open the sidenav -->
<span onclick="openNav2()"><a href="#"><?php
$current_user = wp_get_current_user();
echo 'Bonjour ' . $current_user->display_name . ' ';
// afficher photo user
$user = wp_get_current_user()->ID;
$size = 30;
echo get_avatar( $user, $size );
?>
</a></span>
This works on the home page but not on the other pages while the sections have the same ID.
Can you help me please ?
Hello, Sue this site: http://www.workinprogress.blfacademie.be/ I put a sidebar with button that pushes the contents of the website For this in the code below I put the different parts of the site in sections <style> /* The side navigation menu */ .sidenav2 { height: 100%; /* 100% Full-height */ width: 0; /* 0 width - change this with JavaScript */ position: fixed; /* Stay in place */ z-index: 1; /* Stay on top */ top: 0; right: 0; background-color: #ffffff; /* Black*/ overflow-x: hidden; /* Disable horizontal scroll */ padding-top: 60px; /* Place content 60px from the top */ transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */ border-left: 1px solid #E5E5E5; } /* The navigation menu links */ .sidenav2 a { /*padding: 8px 8px 8px 32px;*/ text-decoration: none; font-size: 13px; color: #343434; display: block; transition: 0.3s; text-indent: -13px; padding-left: 10px; } /* When you mouse over the navigation links, change their color */ .sidenav2 a:hover, .offcanvas a:focus{ color: #818181; } .sidenav2 a:before { content: "•"; padding-right: 8px; /*color: #9e0e0e;*/ } /* Position and style the close button (top right corner) */ .sidenav2 .closebtn2 { position: absolute; top: -4px; right: 12px; font-size: 36px; margin-left: 50px; } /* Style page content - use this if you want to push the page content to the right when you open the side navigation */ #main2 { transition: margin-right .5s; } /* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */ @media screen and (max-height: 450px) { .sidenav2 {padding-top: 15px;} .sidenav2 a {font-size: 18px;} } title { display:block !important; color: #9e0e0e; text-align: center; border-bottom: 1px solid; margin-top: 20px; margin-bottom: 10px; } </style> <script> /* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */ function openNav2() { document.getElementById("mySidenav2").style.width = "250px"; document.getElementById("mySidenav2").style.left = "inherit"; document.getElementById("section3").style.marginRight = "250px"; document.getElementById("section6").style.marginRight = "250px"; document.getElementById("section2").style.marginRight = "250px"; document.body.style.backgroundColor = "rgba(0,0,0,0.4)"; } /* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */ function closeNav2() { document.getElementById("mySidenav2").style.width = "0"; document.getElementById("section3").style.marginRight = "0"; document.getElementById("section6").style.marginRight = "0"; document.getElementById("section2").style.marginRight = "0"; document.body.style.backgroundColor = "white"; } </script> <div id="mySidenav2" class="sidenav2"> <a href="javascript:void(0)" class="closebtn2" onclick="closeNav2()">×</a> <br /> <div style="padding:0 20px;color:#343434;"> <center><?php // afficher photo user $user = wp_get_current_user()->ID; $size = 100; echo get_avatar( $user, $size ); ?></center> <br /> <strong> <?php $current_user = wp_get_current_user(); echo 'Bonjour ' . $current_user->display_name . '<br /><br />'; ?> </strong> <?php dynamic_sidebar('area-3-widget-area'); ?> </div> </div> <!-- Use any element to open the sidenav --> <span onclick="openNav2()"><a href="#"><?php $current_user = wp_get_current_user(); echo 'Bonjour ' . $current_user->display_name . ' '; // afficher photo user $user = wp_get_current_user()->ID; $size = 30; echo get_avatar( $user, $size ); ?> </a></span> This works on the home page but not on the other pages while the sections have the same ID. Can you help me please ?
Vote to pay developers attention to this features or issue.