Files
2022-11-04 13:24:24 +02:00

184 lines
5.9 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<title>Basic usage</title>
<meta charset="utf-8">
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">
<script src="../../js/jquery.min.js"></script>
<script src="../../js/jszip.min.js"></script>
<script src="../../js/kendo.all.min.js"></script>
<script src="../content/shared/js/console.js"></script>
<script>
</script>
</head>
<body>
<a class="offline-button" href="../index.html">Back</a>
<div id="example">
<div class="demo-section k-content">
<h2>What are your favourite recent movies?</h2>
<ul class="forms">
<li>
<label>First favourite</label><select id="favouriteMovie1" style="width: 100%;">
<option value="fastAndFurious">Fast and Furious 6</option>
<option value="nowYouSeeMe">Now you see me</option>
<option value="theHelp">The Help</option>
<option value="theInternship" selected>The Internship</option>
<option value="thePerks">The Perks of Being a Wallflower</option>
</select>
</li>
<li>
<label>Second favourite</label><select id="favouriteMovie2" style="width: 100%;">
<option value="fastAndFurious" selected>Fast and Furious 6</option>
<option value="nowYouSeeMe">Now you see me</option>
<option value="theHelp">The Help</option>
<option value="theInternship">The Internship</option>
<option value="thePerks">The Perks of Being a Wallflower</option>
</select>
</li>
<li>
<label>Third favourite</label><select id="favouriteMovie3" style="width: 100%;">
<option value="fastAndFurious">Fast and Furious 6</option>
<option value="nowYouSeeMe" selected>Now you see me</option>
<option value="theHelp">The Help</option>
<option value="theInternship">The Internship</option>
<option value="thePerks">The Perks of Being a Wallflower</option>
</select>
</li>
<li>
<button id ="voteButton" class="k-button k-primary">Vote</button>
</li>
</ul>
</div>
<div class="demo-section k-content">
<h2>Poll results</h2>
<ul class="poll-results">
<li>
<h4>Fast and Furious 6</h4>
<div id="fastAndFurious"></div>
</li>
<li>
<h4>Now you see me</h4>
<div id="nowYouSeeMe"></div>
</li>
<li>
<h4>The Help</h4>
<div id="theHelp"></div>
</li>
<li>
<h4>The Internship</h4>
<div id="theInternship"></div>
</li>
<li>
<h4>The Perks of Being a Wallflower</h4>
<div id="thePerks"></div>
</li>
</ul>
</div>
<script>
$(document).ready(function () {
var progressbars = [];
$(".poll-results div").each(function () {
var pb = $(this).kendoProgressBar({
type: "percent",
animation: {
duration: 600
}
}).data("kendoProgressBar");
progressbars.push(pb);
});
$("#example select").each(function (i) {
$(this).kendoDropDownList();
});
$("#voteButton").click(function () {
var first = $("#favouriteMovie1").val();
var second = $("#favouriteMovie2").val();
var third = $("#favouriteMovie3").val();
if (first !== "" && second !== "" && third !== "" &&
first !== second && second !== third && first !== third) {
$.each(progressbars, function (i, pb) {
pb.value(0);
});
$("#" + first).data("kendoProgressBar").value(50);
$("#" + second).data("kendoProgressBar").value(30);
$("#" + third).data("kendoProgressBar").value(10);
$.each(progressbars, function (i, pb) {
if (pb.value() === 0) {
pb.value(5);
}
});
} else {
alert("Please select three different movies");
}
});
});
</script>
<style>
.demo-section h2 {
font-weight: normal;
margin-bottom: 15px;
}
.forms {
list-style-type: none;
padding: 0;
margin: 0;
}
.forms label {
display: block;
font-size: 12px;
line-height: 1em;
font-weight: bold;
text-transform: uppercase;
margin-bottom: 1em;
}
.forms li {
margin-bottom: 1.5em;
}
#voteButton {
width: 100%;
}
.poll-results {
list-style-type: none;
margin: 0;
padding: 0;
}
.poll-results li:after {
content: "";
display: block;
clear: both;
height: 3px;
line-height: 0;
}
.poll-results .k-progressbar {
margin-bottom: 1.5em;
width: 100%;
}
</style>
</div>
</body>
</html>