forked from sustainablepace/mobipick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo-progressive-enhancement.html
78 lines (76 loc) · 2.93 KB
/
demo-progressive-enhancement.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html>
<head>
<title>Mobi Pick - An Android-style datepicker widget for jQuery Mobile - Progressive enhancement demo</title>
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0' />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="demo/favicon.ico" type="image/x-icon" />
<style type="text/css">
div.demo {
border-bottom: 1px dotted gray;
margin: 2em 0;
}
input {
margin: 2em 0;
}
</style>
<link rel="stylesheet" href="external/jquery.mobile-1.3.0.min.css" />
<link href="demo/shCoreDefault.css" rel="stylesheet" type="text/css" />
<link href="demo/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="demo/shCore.js"></script>
<script type="text/javascript" src="demo/shBrushJScript.js"></script>
<script type="text/javascript" src="demo/shBrushXml.js"></script>
<script type="text/javascript" src="external/modernizr.custom.min.js"></script>
<script type="text/javascript" src="external/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="external/jquery.mobile-1.3.0.min.js"></script>
<script type="text/javascript">
// Load mobile datepicker if necessary
// from http://css-tricks.com/8678-progressively-enhancing-html5-forms/
yepnope({
test: Modernizr.inputtypes.date,
nope: [
"external/xdate.js",
"external/xdate.i18n.js",
"js/mobipick.js",
"demo/mobipick-custom.js",
"css/mobipick.css"
]
});
$( document ).on( "pagecreate", "#progressiveenhancementdemo", function() {
SyntaxHighlighter.all();
});
</script>
</head>
<body>
<div id="progressiveenhancementdemo" data-role="page" data-add-back-btn="true" class="ui-body-b">
<div data-role="header" class="ui-body-b">
<h1>Mobi Pick - Progressive enhancement demo</h1>
</div>
<div data-role="content" class="ui-body-b">
<div class="demo">
<h1>Progressive enhancement demo</h1>
If your browser has native support for date inputs, you should see these below. In any other browser, Mobi Pick will appear.
<input class="mobipick-demo-basic" type="date" />
<strong>In this case you need a date input!</strong>
<pre class="brush:xml"><input type="date" /></pre>
Load Mobi Pick and dependencies when browser has support for date inputs. <strong>Requires Modernizr</strong>.
<pre class="brush: js">
yepnope({
test: Modernizr.inputtypes.date,
nope: [
"external/xdate.js",
"external/xdate.i18n.js",
"js/mobipick.js",
"demo/mobipick-custom.js",
"css/mobipick.css"
]
});</pre>
<strong>mobipick-custom.js</strong> contains the following code, which applies Mobi Pick to date input (basic configuration).
<pre class="brush: js">
$( "input[type='date']" ).mobipick();</pre>
</div>
Created by Christoph Baudson. Feel free to check out my <a href="http://blog.baudson.de">blog</a>.
</div>
</div>
</body>
</html>