Materialise - Liste déroulante

Materialise fournit une classe CSS déroulante pour créer un élément ul en tant que liste déroulante et ajouter l'id de l'élément ul à l'attribut data-activates du bouton ou de l'élément d'ancrage. Le tableau suivant mentionne les classes disponibles et leurs effets.

Sr.No. Nom et description de la classe
1

dropdown-content

Identifie ul en tant que composant de liste déroulante de matérialisation. Requis pour l'élément ul.

2

data-activates

id de l'élément ul déroulant.

Exemple

Voici un exemple d'utilisation d'une liste déroulante.

materialize_dropdowns.htm

<!DOCTYPE html>
<html>
   <head>
      <title>The Materialize Dropdowns Example</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">      
      <link rel = "stylesheet"
         href = "https://fonts.googleapis.com/icon?family=Material+Icons">
      <link rel = "stylesheet"
         href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
      <script type = "text/javascript"
         src = "https://code.jquery.com/jquery-2.1.1.min.js"></script>           
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js">
      </script> 
   </head>
   
   <body class = "container"> 
      <h3>Drop Down Demo</h3>
      <ul id = "dropdown" class = "dropdown-content">
         <li><a href = "#">Inbox<span class = "badge">12</span></a></li>
         <li><a href = "#!">Unread<span class = "new badge">4</span></a></li>
         <li><a href = "#">Sent</a></li>
         <li class = "divider"></li>
         <li><a href = "#">Outbox<span class = "badge">14</span></a></li>
      </ul>
      
      <a class = "btn dropdown-button" href = "#" data-activates = "dropdown">Mail Box
         <i class = "mdi-navigation-arrow-drop-down right"></i></a>	 
   </body>
</html>

Résultat

Vérifiez le résultat.