mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
New version 2.1.6
Fixed bug with scroller hidden inline mode
This commit is contained in:
parent
edeae329a5
commit
72e400dca1
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name":"datetimepicker",
|
"name":"datetimepicker",
|
||||||
"version":"2.1.5",
|
"version":"2.1.6",
|
||||||
"main": [
|
"main": [
|
||||||
"jquery.datetimepicker.js",
|
"jquery.datetimepicker.js",
|
||||||
"jquery.datetimepicker.css"
|
"jquery.datetimepicker.css"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datetimepicker",
|
"name": "datetimepicker",
|
||||||
"version": "2.1.5",
|
"version": "2.1.6",
|
||||||
"title": "jQuery Date and Time picker",
|
"title": "jQuery Date and Time picker",
|
||||||
"description": "jQuery plugin for date, time, or datetime manipulation in form",
|
"description": "jQuery plugin for date, time, or datetime manipulation in form",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
7
doc.tpl
7
doc.tpl
@ -1,9 +1,11 @@
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>DateTimePicker <small>jQuery plugin select date and time</small></h1>
|
<h1>DateTimePicker <small>jQuery plugin select date and time</small></h1>
|
||||||
</div>
|
</div>
|
||||||
|
<?php echo $this->parse('right250x250',array('link'=>"https://github.com/xdan/datetimepicker/archive/master.zip"))?>
|
||||||
<p>
|
<p>
|
||||||
Use this plugin to unobtrusively add a datetimepicker, datepicker or timepicker dropdown to your forms. It's easy to customize options. <a href="https://github.com/xdan/datetimepicker">Source code on GitHub</a> or <a href="https://github.com/xdan/datetimepicker/archive/master.zip">download (zip)</a>.
|
Use this plugin to unobtrusively add a datetimepicker, datepicker or timepicker dropdown to your forms. It's easy to customize options. <a href="https://github.com/xdan/datetimepicker">Source code on GitHub</a> or <a href="https://github.com/xdan/datetimepicker/archive/master.zip">download (zip)</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>DateTimepicker</h3>
|
<h3>DateTimepicker</h3>
|
||||||
<input type="text" value="2014/03/15 05:06" id="datetimepicker"/><br/>
|
<input type="text" value="2014/03/15 05:06" id="datetimepicker"/><br/>
|
||||||
<h3>Use mask DateTimepicker</h3>
|
<h3>Use mask DateTimepicker</h3>
|
||||||
@ -36,9 +38,6 @@ $('#datetimepicker3').datetimepicker({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
<a class="btn btn-large btn-primary" href="https://github.com/xdan/datetimepicker/archive/master.zip">Download (zip)</a>
|
|
||||||
</p>
|
|
||||||
<h2>How do I use it?</h2>
|
<h2>How do I use it?</h2>
|
||||||
<p>
|
<p>
|
||||||
First include to page css and js files
|
First include to page css and js files
|
||||||
@ -63,6 +62,7 @@ $(function(){$('#_datetimepicker').datetimepicker();});
|
|||||||
|
|
||||||
<hr id="i18n"/>
|
<hr id="i18n"/>
|
||||||
<h4>i18n DatePicker Example <a href="#i18n">#</a></h4>
|
<h4>i18n DatePicker Example <a href="#i18n">#</a></h4>
|
||||||
|
<p>All supported languages <a href="#lang">here</a></p>
|
||||||
<p><strong>javaScript</strong></p>
|
<p><strong>javaScript</strong></p>
|
||||||
<pre><code data-language="javascript">$('#datetimepicker1').datetimepicker({
|
<pre><code data-language="javascript">$('#datetimepicker1').datetimepicker({
|
||||||
lang:'de',
|
lang:'de',
|
||||||
@ -420,6 +420,7 @@ $('#_datetimepicker_weekends_disable').datetimepicker({
|
|||||||
<strong>fr</strong> - French<br>
|
<strong>fr</strong> - French<br>
|
||||||
<strong>es</strong> - Spanish<br>
|
<strong>es</strong> - Spanish<br>
|
||||||
<strong>th</strong> - Thai</td>
|
<strong>th</strong> - Thai</td>
|
||||||
|
<strong>pl</strong> - Polish</td>
|
||||||
<td>
|
<td>
|
||||||
<pre><code data-language="javascript">{lang:'ru'}</code></pre>
|
<pre><code data-language="javascript">{lang:'ru'}</code></pre>
|
||||||
</td>
|
</td>
|
||||||
|
13
index.html
13
index.html
@ -29,11 +29,20 @@
|
|||||||
<input type="text" id="datetimepicker8"/>
|
<input type="text" id="datetimepicker8"/>
|
||||||
<h3>disable all weekend</h3>
|
<h3>disable all weekend</h3>
|
||||||
<input type="text" id="datetimepicker9"/>
|
<input type="text" id="datetimepicker9"/>
|
||||||
|
<h3>Show inline</h3>
|
||||||
|
<a href="javascript:var si = document.getElementById('show_inline').style; si.display = (si.display=='none')?'block':'none';return false; ">Show/Hide</a>
|
||||||
|
<div id="show_inline" style="display:none">
|
||||||
|
<input type="text" id="datetimepicker10"/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script src="./jquery.js"></script>
|
<script src="./jquery.js"></script>
|
||||||
<script src="./jquery.datetimepicker.js"></script>
|
<script src="./jquery.datetimepicker.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$('#datetimepicker_mask').datetimepicker({
|
|
||||||
|
$('#datetimepicker10').datetimepicker({
|
||||||
|
step:5,
|
||||||
|
inline:true
|
||||||
|
});/*$('#datetimepicker_mask').datetimepicker({
|
||||||
mask:'9999/19/39 29:59',
|
mask:'9999/19/39 29:59',
|
||||||
});
|
});
|
||||||
$('#datetimepicker').datetimepicker();
|
$('#datetimepicker').datetimepicker();
|
||||||
@ -109,6 +118,6 @@ $('#datetimepicker9').datetimepicker({
|
|||||||
},
|
},
|
||||||
weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
|
weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
|
||||||
timepicker:false
|
timepicker:false
|
||||||
});
|
});*/
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @preserve jQuery DateTimePicker plugin v2.1.5
|
* @preserve jQuery DateTimePicker plugin v2.1.6
|
||||||
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
||||||
* (c) 2014, Chupurnov Valeriy.
|
* (c) 2014, Chupurnov Valeriy.
|
||||||
*/
|
*/
|
||||||
@ -156,7 +156,7 @@
|
|||||||
},
|
},
|
||||||
move = 0,
|
move = 0,
|
||||||
timebox = timeboxparent.children().eq(0),
|
timebox = timeboxparent.children().eq(0),
|
||||||
parentHeight = timeboxparent[0].offsetHeight-2,
|
parentHeight = timeboxparent[0].clientHeight,
|
||||||
height = timebox[0].offsetHeight,
|
height = timebox[0].offsetHeight,
|
||||||
scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
|
scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
|
||||||
scroller = $('<div class="xdsoft_scroller"></div>'),
|
scroller = $('<div class="xdsoft_scroller"></div>'),
|
||||||
@ -167,6 +167,8 @@
|
|||||||
|
|
||||||
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
|
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
|
||||||
scroller.on('mousedown.xdsoft_scroller',function ( event ) {
|
scroller.on('mousedown.xdsoft_scroller',function ( event ) {
|
||||||
|
if( !parentHeight )
|
||||||
|
timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
|
||||||
var pageY = event.pageY,
|
var pageY = event.pageY,
|
||||||
top = parseInt(scroller.css('margin-top')),
|
top = parseInt(scroller.css('margin-top')),
|
||||||
h1 = scrollbar[0].offsetHeight;
|
h1 = scrollbar[0].offsetHeight;
|
||||||
@ -188,12 +190,14 @@
|
|||||||
|
|
||||||
timeboxparent
|
timeboxparent
|
||||||
.on('scroll_element.xdsoft_scroller',function( event,percent ) {
|
.on('scroll_element.xdsoft_scroller',function( event,percent ) {
|
||||||
|
if( !parentHeight )
|
||||||
|
timeboxparent.trigger('resize_scroll.xdsoft_scroller',[percent,true]);
|
||||||
percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
|
percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
|
||||||
scroller.css('margin-top',maximumOffset*percent);
|
scroller.css('margin-top',maximumOffset*percent);
|
||||||
timebox.css('marginTop',-parseInt((height-parentHeight)*percent))
|
timebox.css('marginTop',-parseInt((height-parentHeight)*percent))
|
||||||
})
|
})
|
||||||
.on('resize_scroll.xdsoft_scroller',function( event,_percent ) {
|
.on('resize_scroll.xdsoft_scroller',function( event,_percent,noTriggerScroll ) {
|
||||||
parentHeight = timeboxparent[0].offsetHeight-2;
|
parentHeight = timeboxparent[0].clientHeight;
|
||||||
height = timebox[0].offsetHeight;
|
height = timebox[0].offsetHeight;
|
||||||
var percent = parentHeight/height,
|
var percent = parentHeight/height,
|
||||||
sh = percent*scrollbar[0].offsetHeight;
|
sh = percent*scrollbar[0].offsetHeight;
|
||||||
@ -203,7 +207,8 @@
|
|||||||
scroller.show();
|
scroller.show();
|
||||||
scroller.css('height',parseInt(sh>10?sh:10));
|
scroller.css('height',parseInt(sh>10?sh:10));
|
||||||
maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight;
|
maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight;
|
||||||
timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]);
|
if( noTriggerScroll!==true )
|
||||||
|
timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
timeboxparent.mousewheel&&timeboxparent.mousewheel(function(event, delta, deltaX, deltaY) {
|
timeboxparent.mousewheel&&timeboxparent.mousewheel(function(event, delta, deltaX, deltaY) {
|
||||||
@ -295,7 +300,7 @@
|
|||||||
}else top+=items[0].offsetHeight;
|
}else top+=items[0].offsetHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].offsetHeight-2)));
|
select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].clientHeight)));
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -640,7 +645,7 @@
|
|||||||
stop = false,
|
stop = false,
|
||||||
period = 110;
|
period = 110;
|
||||||
(function arguments_callee4(v) {
|
(function arguments_callee4(v) {
|
||||||
var pheight = timeboxparent[0].offsetHeight-2,
|
var pheight = timeboxparent[0].clientHeight,
|
||||||
height = timebox[0].offsetHeight,
|
height = timebox[0].offsetHeight,
|
||||||
top = Math.abs(parseInt(timebox.css('marginTop')));
|
top = Math.abs(parseInt(timebox.css('marginTop')));
|
||||||
if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) {
|
if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) {
|
||||||
@ -790,7 +795,7 @@
|
|||||||
})
|
})
|
||||||
.on('afterOpen.xdsoft',function() {
|
.on('afterOpen.xdsoft',function() {
|
||||||
if( options.timepicker && timebox.find('.xdsoft_current').length ) {
|
if( options.timepicker && timebox.find('.xdsoft_current').length ) {
|
||||||
var pheight = timeboxparent[0].offsetHeight-2,
|
var pheight = timeboxparent[0].clientHeight,
|
||||||
height = timebox[0].offsetHeight,
|
height = timebox[0].offsetHeight,
|
||||||
top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
|
top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
|
||||||
if( (height-pheight)<top )
|
if( (height-pheight)<top )
|
||||||
@ -865,7 +870,7 @@
|
|||||||
datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) {
|
datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) {
|
||||||
if( !options.scrollTime )
|
if( !options.scrollTime )
|
||||||
return true;
|
return true;
|
||||||
var pheight = timeboxparent[0].offsetHeight-2,
|
var pheight = timeboxparent[0].clientHeight,
|
||||||
height = timebox[0].offsetHeight,
|
height = timebox[0].offsetHeight,
|
||||||
top = Math.abs(parseInt(timebox.css('marginTop'))),
|
top = Math.abs(parseInt(timebox.css('marginTop'))),
|
||||||
fl = true;
|
fl = true;
|
||||||
@ -996,12 +1001,6 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/*.on('focusout.xdsoft',function(event) {
|
|
||||||
clearTimeout(timer1);
|
|
||||||
timer1 = setTimeout(function() {
|
|
||||||
//datetimepicker.trigger('close.xdsoft');
|
|
||||||
},100);
|
|
||||||
});*/
|
|
||||||
},
|
},
|
||||||
destroyDateTimePicker = function( input ) {
|
destroyDateTimePicker = function( input ) {
|
||||||
var datetimepicker = input.data('xdsoft_datetimepicker');
|
var datetimepicker = input.data('xdsoft_datetimepicker');
|
||||||
|
Loading…
Reference in New Issue
Block a user