Browse Source

Make input autofocus faster

pull/1906/merge
jlukic 9 years ago
parent
commit
edd8f7996e
1 changed files with 6 additions and 5 deletions
  1. 11
      src/definitions/modules/modal.js

11
src/definitions/modules/modal.js

@ -557,13 +557,15 @@ $.fn.modal = function(parameters) {
autofocus: function() { autofocus: function() {
if(settings.autofocus) { if(settings.autofocus) {
var var
$inputs = $module.find(':input:visible'),
$inputs = $module.filter(':input').filter(':visible'),
$autofocus = $inputs.filter('[autofocus]'), $autofocus = $inputs.filter('[autofocus]'),
$input = ($autofocus.length > 0) $input = ($autofocus.length > 0)
? $autofocus
: $inputs
? $autofocus.first()
: $inputs.first()
; ;
$input.first().focus();
if($input.length > 0) {
$input.focus();
}
} }
}, },
clickaway: function() { clickaway: function() {
@ -832,7 +834,6 @@ $.fn.modal.settings = {
queue : false, queue : false,
duration : 500, duration : 500,
easing : 'easeOutExpo',
offset : 0, offset : 0,
transition : 'scale', transition : 'scale',

Loading…
Cancel
Save