8.26. Foundation slider

发布时间 :2025-10-25 12:24:38 UTC      

The Foundation slider allows you to drag to select an interval value:

The slider can be used by using the <div class="range-slider" data-slider> Create. In <div> Inside, add two <span> Elements: <span class="range-slider-handle"> Create a rectangular slider (blue background) <span class="range-slider-active-segment"> It is the gray bar behind the slider, which is the area where the slider is dragged.

注意: The slider needs to use JavaScript. So you need to initialize Foundation JS:

8.26.1. Example

<div class="range-slider" data-slider>
  <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>
<!-- Initialize Foundation JS -->
<script>
$(document).ready(function() {
    $(document).foundation();
})
</script>

尝试一下 »

Fillet and disable slider

Use .radius And .round Class to add fillet sliders. Use .disabled Class to disable the slider:

8.26.2. Example

<div class="range-slider" data-slider>..</div>
<div class="range-slider radius" data-slider>...</div>
<div class="range-slider round" data-slider>...</div>
<div class="range-slider disabled" data-slider>...</div>

尝试一下 »

Vertical slider

Use .vertical-range Class and data-options="vertical: true;" To create a vertical slider:

8.26.3. Example

<div class="range-slider vertical-range" data-slider
data-options="vertical: true;">
  <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>

尝试一下 »

Slider value

By default, the slider is placed in the middle of the bar (the value is “50”). Can be done by adding data-options="initial: num" Property to modify the default value:

8.26.4. Example

<div class="range-slider" data-slider data-options="initial: 80;">
  <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>

尝试一下 »

Show slider valu

If we need to display values in real time as the slider is dragged, we can use the <div> Add in data-options="display_selector:#id" Attribute and the element id value matches the id of the slider, as shown in the following example:

8.26.5. Example

<!-- Display the slider value in this span -->
<span id="mySlider"></span>
<div class="range-slider" data-slider data-options="display_selector:
#mySlider;">
  <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>

尝试一下 »

Combined data option

The following example uses the display_selector And initial Data options:

8.26.6. Example

<span id="mySlider"></span>
<div class="range-slider" data-slider data-options="display_selector:
#mySlider; initial: 20;">
 <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>

尝试一下 »

步长

默认情况下,滑块滑动的增加减少的数量为 “1”。可以通过添加 data-options="step: num;" 属性来修改步长值。实例中设置为 25:

8.26.7. Example

<span id="mySlider"></span>
<div class="range-slider" data-slider data-options="display_selector:
#mySlider; step: 25;">
  <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>

尝试一下 »

Custom interval

By default, the range values are “0” to “100”. You can add data-options start And end To set the interval value. The following example sets the range value from “1” to “20”:

8.26.8. Example

<span id="mySlider"></span>
<div class="range-slider" data-slider data-options="display_selector:
#mySlider; start: 1; end: 20;">
  <span class="range-slider-handle"></span>
  <span class="range-slider-active-segment"></span>
</div>

尝试一下 »

Working with Grid

The following is used to use the slider in the mesh:

8.26.9. Example

<div class="row">
  <div class="small-10 columns">
    <div class="range-slider" data-slider
data-options="display_selector: #mySlider;">
      <span class="range-slider-handle"></span>
      <span class="range-slider-active-segment"></span>
    </div>
  </div>
  <div class="small-2 columns">
    <!-- The display element (Tip: use CSS to perfectly position it) -->
    <span id="mySlider" style="display:block;margin-top:14px;"></span>
  </div>
</div>

尝试一下 »

Use Input

The following examples use the <input> Replace <span> To display the value of the slider:

8.26.10. Example

<div class="row">
  <div class="small-10 columns">
    <div class="range-slider" data-slider
data-options="display_selector: #mySlider; initial: 72;">
      <span class="range-slider-handle"></span>
      <span class="range-slider-active-segment"></span>
    </div>
  </div>
  <div class="small-2 columns">
    <!-- The display element (Tip: use CSS to perfectly position it) -->
    <input type="number" id="mySlider" style="margin-top:7px;"
value="72">
  </div>
</div>

尝试一下 »

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.