clean fake input
This commit is contained in:
parent
498ba4a06a
commit
340500fb84
1 changed files with 5 additions and 4 deletions
|
|
@ -1,4 +1,3 @@
|
|||
var startEvent = 'ontouchstart' in window ?'touchstart':'mousedown'
|
||||
;(function ($) {
|
||||
$.fn.fakeInput = function(options) {
|
||||
|
||||
|
|
@ -58,7 +57,7 @@ var startEvent = 'ontouchstart' in window ?'touchstart':'mousedown'
|
|||
|
||||
}
|
||||
|
||||
self.on('click focus',function(){
|
||||
self.on('focus',function(){
|
||||
self.attr('tabindex','-1')
|
||||
var i = $('<input></input>')
|
||||
.prependTo(self)
|
||||
|
|
@ -74,8 +73,10 @@ var startEvent = 'ontouchstart' in window ?'touchstart':'mousedown'
|
|||
i.remove()
|
||||
$(document).off('.fakeInput')
|
||||
})
|
||||
$(document).on(startEvent+'.fakeInput',function(){
|
||||
i.blur()
|
||||
$(document).on('touchstart.fakeInput mousedown.fakeInput',function(e){
|
||||
if (e.originalEvent.target!=i[0]) {
|
||||
i.blur()
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue