Skip to content

Commit

Permalink
增加示例程序
Browse files Browse the repository at this point in the history
  • Loading branch information
zhang committed Mar 18, 2016
1 parent 34f81ed commit 6928cf8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Screenshot
Examples
---
1. see `sample` folder
2. [jsfiddle](https://jsfiddle.net/cqmyg/me1dmz9e/4/)
2. [jsfiddle](https://jsfiddle.net/cqmyg/me1dmz9e/6/)

Browser Support
---
Expand Down
Binary file modified images/range-picker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions sample/sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
<body>
<div class="wrapper" style="width: 400px; margin: 100px auto; padding: 40px;">
<div id="date_range"></div>
<div id="number_range" style="margin-top: 100px;"></div>
<div id="number_range" style="margin-top: 50px;"></div>

<div id="week_range" style="margin-top: 75px"> </div>
<div id="month_range" style="margin-top: 50px"> </div>

<div id="double_date_range" style="margin-top: 75px;"></div>
<div id="double_number_range" style="margin-top: 50px;"></div>

<div id="double_date_range" style="margin-top: 200px;"></div>
<div id="double_number_range" style="margin-top: 100px;"></div>
</div>

<script src="../bower_components/jquery/dist/jquery.js" type="text/javascript"></script>
Expand Down
24 changes: 23 additions & 1 deletion sample/sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return dateFormat(date, "yyyy/MM/dd");
}
});

$("#double_date_range").rangepicker({
type: "double",
startValue: dateFormat(startDate, "yyyy/MM/dd"),
Expand Down Expand Up @@ -58,4 +58,26 @@
return parseInt(100 * (currentPosition / totalPosition));
}
});

var week = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期天"];
$("#week_range").rangepicker({
type: "double",
startValue: week[0],
endValue: week[6],
translateSelectLabel: function(currentPosition, totalPosition) {
var index = parseInt(6 * (currentPosition / totalPosition));
return week[index];
}
});

var month = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"];
$("#month_range").rangepicker({
type: "double",
startValue: month[0],
endValue: month[11],
translateSelectLabel: function(currentPosition, totalPosition) {
var index = parseInt(11 * (currentPosition / totalPosition));
return month[index];
}
});
}());

0 comments on commit 6928cf8

Please sign in to comment.