2015-06-26 20:27:38 -07:00
|
|
|
<!--
|
|
|
|
@license
|
|
|
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
|
|
Code distributed by Google as part of the polymer project is also
|
|
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
|
|
-->
|
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>paper-slider demo</title>
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
|
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
2016-03-21 19:06:21 -07:00
|
|
|
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
|
|
|
|
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
|
2015-12-14 08:43:03 -07:00
|
|
|
<link rel="import" href="../../paper-styles/color.html">
|
2015-06-26 20:27:38 -07:00
|
|
|
<link rel="import" href="../paper-slider.html">
|
|
|
|
|
2016-03-21 19:06:21 -07:00
|
|
|
<style is="custom-style" include="demo-pages-shared-styles">
|
2015-06-26 20:27:38 -07:00
|
|
|
paper-slider {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body unresolved>
|
2016-03-21 19:06:21 -07:00
|
|
|
<div class="vertical-section-container centered">
|
|
|
|
<h3>paper-sliders can have values, secondary progress values, or be disabled.</h3>
|
|
|
|
<demo-snippet>
|
|
|
|
<template>
|
|
|
|
<paper-slider value="21"></paper-slider>
|
|
|
|
<paper-slider value="0"></paper-slider>
|
|
|
|
<paper-slider value="50" secondary-progress="85"></paper-slider>
|
|
|
|
<paper-slider disabled value="33"></paper-slider>
|
|
|
|
</template>
|
|
|
|
</demo-snippet>
|
|
|
|
|
|
|
|
<h3>They can be editable, and styled using custom properties</h3>
|
|
|
|
<demo-snippet>
|
|
|
|
<template>
|
|
|
|
<style is="custom-style">
|
|
|
|
paper-slider.red {
|
|
|
|
--paper-slider-knob-color: var(--paper-red-500);
|
|
|
|
--paper-slider-active-color: var(--paper-red-500);
|
|
|
|
}
|
|
|
|
paper-slider.green {
|
|
|
|
--paper-slider-knob-color: var(--paper-green-500);
|
|
|
|
--paper-slider-active-color: var(--paper-green-500);
|
|
|
|
}
|
|
|
|
paper-slider.blue {
|
|
|
|
--paper-slider-knob-color: var(--paper-light-blue-500);
|
|
|
|
--paper-slider-active-color: var(--paper-light-blue-500);
|
|
|
|
}
|
|
|
|
</style>
|
2015-06-26 20:27:38 -07:00
|
|
|
|
|
|
|
<div>R</div>
|
|
|
|
<paper-slider class="red" value="23" max="255" editable></paper-slider>
|
|
|
|
<div>G</div>
|
|
|
|
<paper-slider class="green" value="183" max="255" editable></paper-slider>
|
|
|
|
<div>B</div>
|
|
|
|
<paper-slider class="blue" value="211" max="255" editable></paper-slider>
|
2016-03-21 19:06:21 -07:00
|
|
|
</template>
|
|
|
|
</demo-snippet>
|
|
|
|
|
|
|
|
<h3>The pins can be labelled</h3>
|
|
|
|
<demo-snippet>
|
|
|
|
<template>
|
|
|
|
<style is="custom-style">
|
|
|
|
.caption {
|
|
|
|
padding-left: 12px;
|
|
|
|
color: #a0a0a0;
|
|
|
|
}
|
|
|
|
#grade {
|
|
|
|
--paper-slider-secondary-color: var(--paper-red-a200);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div>Brightness</div><br>
|
|
|
|
<paper-slider pin value="20"></paper-slider>
|
|
|
|
<div>Ratings: <span id="ratingsLabel" class="caption"></span></div><br>
|
|
|
|
<paper-slider id="ratings" pin snaps max="10" max-markers="10" step="1" value="5"></paper-slider>
|
|
|
|
<div>Grade: <span id="gradeLabel" class="caption"></span></div><br>
|
|
|
|
<paper-slider id="grade" pin value="20" secondary-progress="70"></paper-slider>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
document.addEventListener('WebComponentsReady', function() {
|
|
|
|
var ratings = document.querySelector('#ratings');
|
|
|
|
ratings.addEventListener('value-change', function() {
|
|
|
|
document.querySelector('#ratingsLabel').textContent = ratings.value;
|
|
|
|
});
|
|
|
|
|
|
|
|
var grade = document.querySelector('#grade');
|
|
|
|
grade.addEventListener('value-change', function() {
|
|
|
|
var label = (grade.value < grade.secondaryProgress) ? "Fail" : "Pass" ;
|
|
|
|
document.querySelector('#gradeLabel').textContent = grade.value + " (" + label + ")";
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</template>
|
|
|
|
</demo-snippet>
|
2015-06-26 20:27:38 -07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
2016-03-21 19:06:21 -07:00
|
|
|
document.addEventListener('WebComponentsReady', function() {
|
|
|
|
var ratings = document.querySelector('#ratings');
|
|
|
|
ratings.addEventListener('value-change', function() {
|
|
|
|
document.querySelector('#ratingsLabel').textContent = ratings.value;
|
|
|
|
});
|
|
|
|
|
|
|
|
var grade = document.querySelector('#grade');
|
|
|
|
grade.addEventListener('value-change', function() {
|
|
|
|
var label = (grade.value < grade.secondaryProgress) ? "Fail" : "Pass" ;
|
|
|
|
document.querySelector('#gradeLabel').textContent = grade.value + " (" + label + ")";
|
|
|
|
});
|
2015-10-07 18:49:40 -07:00
|
|
|
});
|
2015-06-26 20:27:38 -07:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|