diff --git a/index.html b/index.html
index cc0dd68..99a4e09 100644
--- a/index.html
+++ b/index.html
@@ -1,10 +1,16 @@
-
-
-
-
+ DateTimePicker
+
+ TimePicker
+
+ DatePicker
+
+ Inline DateTimePicker
+
+ Button Trigger
+
@@ -23,5 +29,12 @@ $('#datetimepicker2').datetimepicker({
$('#datetimepicker3').datetimepicker({
inline:true,
});
+$('#datetimepicker4').datetimepicker();
+$('#open').click(function(){
+ $('#datetimepicker4').datetimepicker('show');
+});
+$('#close').click(function(){
+ $('#datetimepicker4').datetimepicker('hide');
+});
diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js
index 28ab4d8..d9563af 100644
--- a/jquery.datetimepicker.js
+++ b/jquery.datetimepicker.js
@@ -1,5 +1,5 @@
/**
- * @preserve jQuery DateTimePicker plugin v1.0.1
+ * @preserve jQuery DateTimePicker plugin v1.0.3
* (c) 2013, Chupurnov Valeriy.
*/
(function( $ ){
@@ -62,7 +62,7 @@
dayOfWeekStart:0,
timeHeightInTimePicker:25,
};
- var options = $.extend({},default_options,opt);
+ var options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options);
var createDateTimePicker = function( input ){
var datetimepicker = $(''),
xdsoft_copyright = $(''),
@@ -395,8 +395,21 @@
};
return this.each(function(){
- if( $(this).data('xdsoft_datetimepicker') ){
- $(this).data('xdsoft_datetimepicker').setOptions(options);
+ var datetimepicker;
+ if( datetimepicker = $(this).data('xdsoft_datetimepicker') ){
+ //$(this).data('xdsoft_datetimepicker').setOptions(options);
+ if( $.type(opt) === 'string' ){
+ switch(opt){
+ case 'show':
+ datetimepicker.open();
+ break;
+ case 'hide':
+ datetimepicker.close();
+ break;
+ }
+ }else{
+ $(this).data('xdsoft_datetimepicker').setOptions(options);
+ }
return 0;
}
createDateTimePicker($(this));