案例:jQuery UI案例     状态:可编辑再运行    进入竖版
 运行结果 
AخA
 
1
<!doctype html>
2
<html>
3
<head>
4
  <meta charset="utf-8">
5
  <title>jQuery UI 旋转器(Spinner) - 时间</title>
6
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
7
  <script src="//code.jquery.com/jquery-1.9.1.js"></script>
8
  <script src="/static/js/jqueryui/resources/demos/external/jquery.mousewheel.js"></script>
9
  <script src="/static/js/jqueryui/resources/demos/external/globalize.js"></script>
10
  <script src="/static/js/jqueryui/resources/demos/external/globalize.culture.de-DE.js"></script>
11
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
12
  <link rel="stylesheet" href="https://jqueryui.com/resources/demos/style.css">
13
  <script>
14
  $.widget( "ui.timespinner", $.ui.spinner, {
15
    options: {
16
      // 秒
17
      step: 60 * 1000,
18
      // 小时
19
      page: 60
20
    },
21
 
22
    _parse: function( value ) {
23
      if ( typeof value === "string" ) {
24
        // 已经是一个时间戳
25
        if ( Number( value ) == value ) {
26
          return Number( value );
27
        }
28
        return +Globalize.parseDate( value );
29
      }
30
      return value;
31
    },
32
 
33
    _format: function( value ) {
34
      return Globalize.format( new Date(value), "t" );
35
    }
36
  });
37
 
38
  $(function() {
39
    $( "#spinner" ).timespinner();
40
 
41
    $( "#culture" ).change(function() {
42
      var current = $( "#spinner" ).timespinner( "value" );
43
      Globalize.culture( $(this).val() );
44
      $( "#spinner" ).timespinner( "value", current );
45
    });
46
  });
47
  </script>
48
</head>