Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
Added onKeypadOpen and onKeypadClose
  • Loading branch information
Andrej Kabachnik committed Jul 8, 2015
1 parent e160f36 commit 7214b6b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
9 changes: 9 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### v1.1
* Added <code>onKeypadOpen</code> and <code>onKeypadClose</code> callbacks and corresponding <code>numpad.open</code> and <code>numpad.close</code> events

### v1.0.1
* Added support for Bootstrap
* Added Bootstrap demo

### v1.0
* Initial Releas
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ function($){
- Add support for negative numbers
- Add support for fractions
- Add position options to place the keypad above or aside the target element
- Add an onClose callback to support custom target elements
- Add an onOpen callback to support custom initial values
- Make a simple calculator

## License
Expand Down
12 changes: 11 additions & 1 deletion jquery.numpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
if (options.onKeypadCreate){
nmpd.on('numpad.create', options.onKeypadCreate);
}
if (options.onKeypadOpen){
nmpd.on('numpad.open', options.onKeypadOpen);
}
if (options.onKeypadClose){
nmpd.on('numpad.close', options.onKeypadClose);
}
(options.appendKeypadTo ? options.appendKeypadTo : $(document.body)).append(nmpd);

$('#'+id+' .numero').bind('click', function(){
Expand Down Expand Up @@ -110,6 +116,7 @@
}
}
nmpd.hide();
nmpd.trigger('numpad.close');
return nmpd;
};

Expand All @@ -127,6 +134,7 @@
nmpd.show().find('.cancel').focus();
position(nmpd.find('.nmpd-grid'), options.position, options.positionX, options.positionY);
$('#'+id+' .done').one('click', function(){ nmpd.close(target); });
nmpd.trigger('numpad.open');
return nmpd;
};
});
Expand Down Expand Up @@ -183,6 +191,8 @@
position: 'fixed',
positionX: 'center',
positionY: 'middle',
onKeypadCreate: false
onKeypadCreate: false,
onKeypadOpen: false,
onKeypadClose: false
};
})(jQuery);

0 comments on commit 7214b6b

Please sign in to comment.