Skip to content

Commit

Permalink
added toggle option to allow the trigger to either toggle the calenda…
Browse files Browse the repository at this point in the history
…r, or just show (default)
  • Loading branch information
bradrobertson committed Sep 4, 2011
1 parent be592b9 commit d6a877a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/dateinput/dateinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
min: undefined,
max: undefined,
trigger: 0,
toggle: 0,
editable: 0,

css: {
Expand Down Expand Up @@ -257,7 +258,7 @@
// trigger icon
if (conf.trigger) {
trigger = $("<a/>").attr("href", "#").addClass(css.trigger).click(function(e) {
self.show();
conf.toggle ? self.toggle() : self.show();
return e.preventDefault();
}).insertAfter(input);
}
Expand Down Expand Up @@ -670,6 +671,10 @@
return self;
},

toggle: function(){
return self.isOpen() ? self.hide() : self.show();
},

getConf: function() {
return conf;
},
Expand Down
3 changes: 2 additions & 1 deletion test/dateinput/customized.htm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
speed: 'fast',
selectors: false,
yearRange: [-75, -10],
trigger: true
trigger: true,
toggle: true
});
</script>

Expand Down

0 comments on commit d6a877a

Please sign in to comment.