Skip to content

Commit 0241ce1

Browse files
committed
Added files
1 parent d2f848b commit 0241ce1

File tree

4 files changed

+555
-0
lines changed

4 files changed

+555
-0
lines changed

css/jquery.dateselect.css

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
/**
2+
* jQuery DateSelect
3+
* @author biohzrdmx <github.com/biohzrdmx>
4+
* @license MIT
5+
*/
6+
.date-select {
7+
8+
position: absolute;
9+
}
10+
11+
.date-select .popup {
12+
13+
position: absolute;
14+
left: 0;
15+
top: 0;
16+
width: 302px;
17+
height: 141px;
18+
padding: 1px;
19+
z-index: 15;
20+
background: #FFF;
21+
border: 1px solid #CCC;
22+
/* box-shadow */
23+
-webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
24+
box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
25+
/* box-sizing */
26+
-webkit-box-sizing: content-box;
27+
-moz-box-sizing: content-box;
28+
box-sizing: content-box;
29+
}
30+
31+
.date-select .tip {
32+
33+
position: absolute;
34+
left: 12px;
35+
top: -12px;
36+
z-index: 5;
37+
width: 0;
38+
height: 0;
39+
border-left: 10px solid transparent;
40+
border-right: 10px solid transparent;
41+
border-bottom: 12px solid #CCC;
42+
}
43+
44+
.date-select .tip:before {
45+
46+
content: ' ';
47+
position: absolute;
48+
left: -8px;
49+
top: 2px;
50+
z-index: 20;
51+
width: 0;
52+
height: 0;
53+
border-left: 8px solid transparent;
54+
border-right: 8px solid transparent;
55+
border-bottom: 10px solid #FFF;
56+
}
57+
58+
.date-select .select {
59+
60+
width: 100px;
61+
height: 100px;
62+
float: left;
63+
margin-right: 1px;
64+
color: #222;
65+
position: relative;
66+
cursor: default;
67+
}
68+
69+
.date-select .select.year {
70+
71+
margin-right: 0;
72+
}
73+
74+
.date-select .select span {
75+
76+
display: block;
77+
margin: 0 10px 0;
78+
}
79+
80+
.date-select .select span.num {
81+
82+
font-size: 34px;
83+
position: absolute;
84+
left: 0;
85+
bottom: 28px;
86+
color: #555;
87+
}
88+
89+
.date-select .select span.text {
90+
91+
font-size: 12px;
92+
text-transform: uppercase;
93+
position: absolute;
94+
left: 0;
95+
bottom: 18px;
96+
}
97+
98+
.date-select .select:hover {
99+
100+
background: #1196CE;
101+
color: #FFF;
102+
}
103+
104+
.date-select .select:hover span {
105+
106+
color: #FFF;
107+
}
108+
109+
.date-select .select a.btn-arrow {
110+
111+
position: absolute;
112+
}
113+
114+
.date-select .select a.btn-arrow.btn-up {
115+
116+
left: 0;
117+
top: 0;
118+
width: 100%;
119+
height: 20px;
120+
}
121+
122+
.date-select .select a.btn-arrow.btn-down {
123+
124+
left: 0;
125+
bottom: 0;
126+
width: 100%;
127+
height: 20px;
128+
}
129+
130+
.date-select .select .icon {
131+
132+
display: block;
133+
margin: 7px auto;
134+
width: 0;
135+
height: 0;
136+
/* transition */
137+
-webkit-transition: opacity 0.3s;
138+
-moz-transition: opacity 0.3s;
139+
-ms-transition: opacity 0.3s;
140+
-o-transition: opacity 0.3s;
141+
transition: opacity 0.3s;
142+
/* opacity */
143+
filter: alpha(opacity=0);
144+
opacity: 0;
145+
}
146+
147+
.date-select .select .icon.icon-up {
148+
149+
border-left: 5px solid transparent;
150+
border-right: 5px solid transparent;
151+
border-bottom: 6px solid #87CAE6;
152+
}
153+
154+
.date-select .select .icon.icon-down {
155+
156+
border-left: 5px solid transparent;
157+
border-right: 5px solid transparent;
158+
border-top: 6px solid #87CAE6;
159+
}
160+
161+
.date-select .select:hover .icon {
162+
163+
/* opacity */
164+
filter: alpha(opacity=100);
165+
opacity: 1;
166+
}
167+
168+
.date-select .select a.btn-arrow:hover .icon.icon-up {
169+
170+
border-bottom-color: #FFF;
171+
}
172+
173+
.date-select .select a.btn-arrow:hover .icon.icon-down {
174+
175+
border-top-color: #FFF;
176+
}
177+
178+
.date-select .buttons {
179+
180+
margin: 101px auto 0;
181+
width: 302px;
182+
}
183+
184+
.date-select .buttons a {
185+
186+
display: block;
187+
width: 151px;
188+
height: 40px;
189+
color: #343434;
190+
text-align: center;
191+
line-height: 40px;
192+
font-size: 18px;
193+
float: left;
194+
}
195+
196+
.date-select .buttons a:hover {
197+
198+
color: #FFF;
199+
}
200+
201+
.date-select .buttons a.btn-ok {
202+
203+
width: 150px;
204+
margin-left: 1px;
205+
}
206+
207+
.date-select .buttons a.btn-ok:hover {
208+
209+
background: #69B22C;
210+
}
211+
212+
.date-select .buttons a.btn-cancel:hover {
213+
214+
background: #D95005;
215+
}

index.html

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>jQuery DateSelect</title>
6+
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
7+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
8+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css">
9+
<link rel="stylesheet" href="css/jquery.dateselect.css">
10+
<style>
11+
.date-select { font-family: 'Open Sans', sans-serif; }
12+
</style>
13+
</head>
14+
<body>
15+
<div class="container">
16+
<h2>jQuery DateSelect</h2>
17+
<p>There are a lot of date pickers out there, but why have an old and boring calendar when you can have a modern and slick date selector?</p>
18+
<p>Meet DateSelect, a new way to select dates on your forms.</p>
19+
<h2>Installing</h2>
20+
<p>Just grab the JS and CSS files, include them on your HTML file and you're set.</p>
21+
<pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;css/jquery.dateselect.css&quot;&gt;</pre>
22+
<pre>&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.dateselect.js&quot;&gt;&lt;/script&gt;</pre>
23+
<h2>Basic usage</h2>
24+
<p>This awesome plugin has two operation modes: <strong>automatic</strong> or <strong>manual</strong>.</p>
25+
<!-- Auto mode -->
26+
<h3 for="">Automatic mode</h3>
27+
<p>In automatic mode you'll just have to add a <code>data-*</code> attribute and the plugin will do all thee work (but for this to work, you must have also a valid HTML 5 DOCTYPE).</p>
28+
<p>If you can't (or don't want to) add a DOCTYPE you can still use the good old <code>$('#input').dateSelect()</code> to bind your input fields.</p>
29+
<p><strong>HTML</strong></p>
30+
<pre>&lt;input type=&quot;text&quot; name=&quot;date1&quot; id=&quot;date1&quot; class=&quot;form-control&quot; data-select=&quot;date&quot;&gt;
31+
&lt;span class=&quot;input-group-btn&quot;&gt;
32+
&lt;button class=&quot;btn btn-primary&quot; type=&quot;button&quot; data-toggle=&quot;select&quot;&gt;&lt;i class=&quot;fa fa-calendar&quot;&gt;&lt;/i&gt;&lt;/button&gt;
33+
&lt;/span&gt;</pre>
34+
<p><strong>Result</strong></p>
35+
<div class="well">
36+
<div class="row">
37+
<div class="col-md-3">
38+
<div class="input-group">
39+
<input type="text" name="date1" id="date1" class="form-control" data-select="date">
40+
<span class="input-group-btn">
41+
<button class="btn btn-primary" type="button" data-toggle="select"><i class="fa fa-calendar"></i></button>
42+
</span>
43+
</div>
44+
</div>
45+
</div>
46+
</div>
47+
<!-- Manual mode -->
48+
<h3 for="">Manual mode</h3>
49+
<p>In manual mode, you'll have to call the <code>$.dateSelect.show()</code> method to open the date picker.</p>
50+
<p><strong>HTML</strong></p>
51+
<pre>&lt;input type=&quot;text&quot; name=&quot;date2&quot; id=&quot;date2&quot; class=&quot;form-control&quot;&gt;
52+
&lt;span class=&quot;input-group-btn&quot;&gt;
53+
&lt;button class=&quot;btn btn-primary btn-date&quot; type=&quot;button&quot;&gt;&lt;i class=&quot;fa fa-calendar&quot;&gt;&lt;/i&gt;&lt;/button&gt;
54+
&lt;/span&gt;</pre>
55+
<p><strong>JS</strong></p>
56+
<pre>$('.btn-date').on('click', function(e) {
57+
e.preventDefault();
58+
$.dateSelect.show({
59+
element: 'input[name=&quot;date2&quot;]'
60+
});
61+
});</pre>
62+
<p><strong>Result</strong></p>
63+
<div class="well">
64+
<div class="row">
65+
<div class="col-md-3">
66+
<div class="input-group">
67+
<input type="text" name="date2" id="date2" class="form-control">
68+
<span class="input-group-btn">
69+
<button class="btn btn-primary btn-date" type="button"><i class="fa fa-calendar"></i></button>
70+
</span>
71+
</div>
72+
</div>
73+
</div>
74+
</div>
75+
<!-- -->
76+
<h3>It's customizable</h3>
77+
<p>You may use the included stylesheet or style it to fit your page design. It's up to you!</p>
78+
<h3>And it works with your mouse wheel too!</h3>
79+
<p>Just include the <a href="https://github.com/brandonaaron/jquery-mousewheel">jQuery MouseWheel plugin</a> and it will automagically make it work.</p>
80+
<h3>So what do you need?</h3>
81+
<ul>
82+
<li><a href="http://jquery.com/">jQuery</a> 1.8+</li>
83+
<li><a href="https://github.com/brandonaaron/jquery-mousewheel">jQuery MouseWheel</a> plugin (optional)</li>
84+
<li><a href="http://fontawesome.io">FontAwesome</a> (for the OK/Cancel icons)</li>
85+
<li>A fairly modern web browser (Firefox, Chrome or Opera suggested. It should work on IE8+, but please stop supporting that crap)</li>
86+
<li>A valid HTML 5 DOCTYPE (strongly recommended)</li>
87+
</ul>
88+
<!-- -->
89+
<h2>Licensing</h2>
90+
<p>This software is released under the MIT license.</p>
91+
<p>Copyright &copy; 2014 biohzrdmx</p>
92+
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
93+
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
94+
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
95+
<h3>Contributing</h3>
96+
<p>Fork the repo, add an interesting feature or fix a bug and send a pull request.</p>
97+
<h3>Troubleshooting</h3>
98+
<p>As was said earlier, this works on Chrome, Firefox and Opera. IE8+ should work too, but we aren't officially supporting it (maybe IE10, but it's still a buggy, crappy browser; please let them die alone).</p>
99+
<p>Safari shouldn't have any problem, after all it's just another webkit flavor.</p>
100+
<!-- -->
101+
<h2>Credits</h2>
102+
<p><strong>Lead coder:</strong> biohzrdmx (<a href="https://github.com/biohzrdmx/">github.com/biohzrdmx</a>)</p>
103+
<br><br>
104+
</div>
105+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js"></script>
106+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.min.js"></script>
107+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.11/jquery.mousewheel.min.js"></script>
108+
<script type="text/javascript" src="js/jquery.dateselect.js"></script>
109+
<script type="text/javascript">
110+
jQuery(document).ready(function($) {
111+
$('.btn-date').on('click', function(e) {
112+
e.preventDefault();
113+
$.dateSelect.show({
114+
element: 'input[name="date2"]'
115+
});
116+
});
117+
});
118+
</script>
119+
</body>
120+
</html>

0 commit comments

Comments
 (0)