Data binding
优质
小牛编辑
130浏览
2023-12-01
描述 (Description)
您可以使用它来显示可见输入和滑块,以便更改其中一个与另一个匹配。 您必须为input分配id并添加aria-controls = "idOfInput" 。
例子 (Example)
以下示例演示如何在Foundation中使用slider data binding 。
<html>
<head>
<title>Slider Data Binding</title>
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
</head>
<body>
<div class = "small-10 columns">
<div class = "slider" data-slider data-initial-start = "30">
<span class = "slider-handle" data-slider-handle role = "slider" tabindex = "1" aria-controls = "sliderOutput"></span>
<span class = "slider-fill" data-slider-fill></span>
</div>
</div>
<div class = "small-2 columns">
<input type = "number" id = "sliderOutput">
</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>