javascript-ej1-demos/slider/dateslider.html

97 строки
3.6 KiB
HTML

<!doctype html>
<html>
<head>
<title>Essential JS 1 : Range Slider</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
<link href="../content/bootstrap.min.css" rel="stylesheet">
<link href="../content/ejthemes/default-theme/ej.web.all.min.css" rel="stylesheet" />
<link href="../content/default.css" rel="stylesheet" />
<link href="../content/default-responsive.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script src="../scripts/jquery-1.11.3.min.js" type="text/javascript" ></script>
<![endif]-->
<!--[if IE 9]><!-->
<script src="../scripts/jquery-3.4.1.min.js" type="text/javascript"> </script>
<!--<![endif]-->
<script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
<script src="../scripts/properties.js" type="text/javascript"></script>
</head>
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div class="frame">
<div class="txt">Default</div>
<div id="defaultSlider"></div>
<br />
<br />
<div class="txt">Min-Range</div>
<div id="minSlider"></div>
<br />
<br />
<div class="txt">Range</div>
<div id="rangeSlider"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
// declaration
$("#defaultSlider").ejSlider({
minValue: new Date(2018,00,01).getTime(),
maxValue: new Date(2018,11,31).getTime(),
incrementStep: 1 * 24 * 60 * 60 * 1000,
value: new Date(2018,04,20).getTime(),
tooltipChange: "onDefaultTooltipChange"
});
$("#minSlider").ejSlider({
sliderType: ej.SliderType.MinRange,
minValue: new Date(2018, 00, 01).getTime(),
maxValue: new Date(2018, 11, 31).getTime(),
incrementStep: 1 * 24 * 60 * 60 * 1000,
value: new Date(2018,04,20).getTime(),
tooltipChange: "onMinRangeTooltipChange"
});
$("#rangeSlider").ejSlider({
sliderType: ej.SliderType.Range,
minValue: new Date(2015,01,01).getTime(),
maxValue: new Date(2025,01,01).getTime(),
incrementStep: 1 * 24 * 60 * 60 * 365 * 1000,
values: [new Date(2018,01,01).getTime(), new Date(2022,01,01).getTime()],
tooltipChange: "onRangeTooltipChange"
});
});
function onDefaultTooltipChange(args) {
var date = new Date(args.value);
var dateValue = ej.format(date, "dd/MM/yyyy")
args.value = dateValue;
}
function onMinRangeTooltipChange(args) {
var date = new Date(args.value);
var dateValue = ej.format(date, "dd/MMMM/yyyy")
args.value = dateValue;
}
function onRangeTooltipChange(args) {
var startDate = new Date(args.value[0]).getFullYear();
var endDate = new Date(args.value[1]).getFullYear();
var value = [startDate, endDate];
args.value = value;
}
</script>
<style type="text/css" class="cssStyles">
.frame {
width: 50%;
}
.txt {
font-size: 15px;
margin-bottom: 13px;
}
</style>
</body>
</html>