Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--
https://forum.alsacreations.com/topic-4-85951-1-Aide-creation-menu-scrollable-avec-fleches.html
-->
<h1>Aide - création menu scrollable avec flèches</h1>
<p>Diminuer la fenêtre en largeur.</p>
<nav class="navBar" id="navBar">
  <div class="container" id="container">
    <ul class="nav" id="nav">
      <li><a href="index.html" class="active">Accueil</a></li>
      <li><a href="Jembes.html">Jemb&eacute;s</a></li>
      <li><a href="Vulcain.html">Vulcain</a></li>
      <li><a href="Jelidunun.html">Jelidunun</a>
      <li><a href="Dunun-PVC.html">Dunun PVC</a>
      <li><a href="Yabara.html">Yabara</a>
      <li><a href="Avertissement.html">Avertissement</a>
      <li><a href="Faire-Soi-Meme.html">DIY</a>
    </ul>
  </div>
</nav>

<hr>
<div class="mise-en-page-lien"> 
  <div class="bloc-mise-en-page bloc-lien bloc-sites">
    <h2>Sites</h2>
    <ul>
      <li><a href="https://www.zonecss.fr/#ExxzyxG0000.codepen" target="_blank" title="Glossaire CSS">Zone CSS</a></li>
      <li><a href="http://www.aliasdmc.fr/#ExxzyxG0000.codepen" target="_blank" title="Glossaire HTML/JAVASCRIPT">Zone (X)HTML</a></li>
      <li><a href="https://web-color.aliasdmc.fr/#ExxzyxG0000.codepen" target="_blank" title="Couleurs pour le WEb (#,rgb,hsl)">Couleurs Web</a></li>
      <li><a href="https://outils-css.aliasdmc.fr/#ExxzyxG0000.codepen" target="_blank">Outils CSS</a></li>
      <li><a href="https://outils-javascript.aliasdmc.fr/#ExxzyxG0000.codepen" target="_blank">Outils Javascript</a></li>
    </ul>
  </div>
</div>
              
            
!

CSS

              
                /* Menu "scroll" */
.topBar {
  background: white;
  color: rgba(255, 255, 255, 0.3);
  font-size: 22px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 20px 0;
  text-align: center;
}
.container {
  margin: 0 auto;
  padding: 0 10px;
  max-width: 800px;
  overflow:hidden;
  display:block;
}
.navBar {
  background-color: blue;
}
.nav {
  margin: 0 -10px;
 padding: 0 10px;
  list-style: none;
  display: flex;
  loverflow-x: scroll;
  o-webkit-overflow-scrolling: touch;
}
.nav > li > a {
  padding: 14px 16px;
  display: block;
  color: lightblue;/* Couleur des liens */
  text-decoration: none;
  text-transform: uppercase;
  font-size: .8em;
  white-space:nowrap;
}
.nav > li > a.active {
  border-bottom: 2px solid #E64A19;
}

/*
///////////////////////////////////////////////////////////
CODE DES BOUTONS
///////////////////////////////////////////////////////////
*/
.BtNavBarRight,
.BtNavBarLeft{
  color:#000;
  background-color:#fff;
  font-size:15px;
  height:15px;
  line-height:15px;
  vertical-align:middle;
  text-align:center;
  width:15px;
  font-weight : bolder;
  padding:5px;
  cursor:pointer;
  display:none;
  border-radius: 3px;
  filter : drop-shadow(2px 3px 3px #000);
  margin-left:5px;
  margin-right:5px;
}
 
.BtNavBarRight:hover,
.BtNavBarLeft:hover{
  filter : drop-shadow(2px 2x 2px #000);
}
@media (max-width: 800px){
  .navBar{
    display:flex;
    align-items : center;
  }
  .BtNavBarRight,
  .BtNavBarLeft{display:block}
}
              
            
!

JS

              
                /* ///////////////////////////////////////////
Plus d'informations liées à la solution  : 
////////////////////////////////////////////// 
*/

/*
Toutes le fonctions ci-dessous peuvent être optimisées
elles sont même volontairement non optimisées
Elles sont là juste pour vous présenter le concept à vous de les améliorer 
*/


function moveElement(oNav, bRight){
  /*
  * iIncrementeVitesse ne pas limite il peux vite monter 
  * il faut le limiter
  */
  
  if(bRight){
    oNav.scrollLeft +=  iIncremente + iIncrementeVitesse;
  }else{
    oNav.scrollLeft -= iIncremente + iIncrementeVitesse;
  }
}//fct

/*
* @param Event oEvent
*/
function deplacer(oEvent){
  let oBt = oEvent.currentTarget,
      sClass = oBt.className,
      sType = oEvent.type;
  /* Le système de déplacement est assez basic à toi de trouver une bonne formule
  * notament pour que cela fonction avec test menu deroulant
  * je pense qui faut decaler non pas par incrémentation mais par la taille de tes Li
  */
  if(sType == 'mouseup'){
    clearInterval(iTimer);
    iIncrementeVitesse = 0.5;
  }else{
    let oNav = document.getElementById("container"),
        isRight = sClass == sClassBtRight;
    moveElement(oNav,isRight);
    iTimer = setInterval(
      function() {
        iIncrementeVitesse += 0.5;
        moveElement(oNav, isRight);
      } , 100);
  }
}

const sClassBtRight= "BtNavBarRight",
      sClassBtLeft= "BtNavBarLeft",
      iIncremente = 10; 
let iTimer =null, iIncrementeVitesse = 0.5;
//Quand les Elements sont accesssibles 
// Dom loaded
document.addEventListener('DOMContentLoaded',function(){
  /* Creation des deux boutons */
  let oBar = document.getElementById("navBar"),
      oBtLeft = document.createElement("div"),
      oBtRight = document.createElement("div");
  oBar.appendChild(oBtRight); 
  oBar.insertBefore(oBtLeft, oBar.firstElementChild);
  oBtRight.innerHTML = ">";
  oBtLeft.innerHTML = "<"
  oBtRight.className = sClassBtRight;
  oBtLeft.className = sClassBtLeft;
  oBtLeft.addEventListener("mousedown",deplacer);
  oBtRight.addEventListener("mousedown",deplacer);
  document.addEventListener("mouseup",deplacer); 
});
              
            
!
999px

Console