Two Handles

优质
小牛编辑
124浏览
2023-12-01

描述 (Description)

要使用两个句柄,您需要使用.slider-handle span和input字段。 它适用于水平和垂直滑块。 JavaScript将为输入字段分配ID,直到您更改它为止。 如果不进行更改,则句柄和输入将按照它们在DOM树中的方式进行匹配。

例子 (Example)

以下示例演示如何在Foundation中使用two handles slider

<html>
   <head>
      <title>Slider Two Handles</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
   </head>
   <body>
      <div class = "slider" data-slider data-initial-start = "30" data-initial-end = "60">
         <span class = "slider-handle" data-slider-handle role = "slider" tabindex = "1"></span>
         <span class = "slider-fill" data-slider-fill></span>
         <span class = "slider-handle" data-slider-handle role = "slider" tabindex = "1"></span>
         <input type = "hidden">
         <input type = "hidden">
      </div>
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
      <script>
         $(document).ready(function() {
            $(document).foundation();
         })
      </script>
   </body>
</html>