Skip to content

Commit

Permalink
'ontouchstart' condition
Browse files Browse the repository at this point in the history
'ontouchstart' condition for netbook with touchscreen.
  • Loading branch information
kazuyevon authored Apr 7, 2018
1 parent 0d18706 commit e239571
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions bootstrap3-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,19 @@
}

var itemTagName = $(this.options.item || this.theme.item).prop('tagName');
if ('ontouchstart' in document.documentElement) {
this.$menu
.on('touchstart', itemTagName, $.proxy(this.touchstart, this))
.on('touchend', itemTagName, $.proxy(this.click, this));
} else {
if ('ontouchstart' in document.documentElement && 'onmousemove' in document.documentElement) {
this.$menu
.on('touchstart', itemTagName, $.proxy(this.touchstart, this))
.on('touchend', itemTagName, $.proxy(this.click, this))
.on('click', $.proxy(this.click, this))
.on('mouseenter', itemTagName, $.proxy(this.mouseenter, this))
.on('mouseleave', itemTagName, $.proxy(this.mouseleave, this))
.on('mousedown', $.proxy(this.mousedown,this));
} else if ('ontouchstart' in document.documentElement) {
this.$menu
.on('touchstart', itemTagName, $.proxy(this.touchstart, this))
.on('touchend', itemTagName, $.proxy(this.click, this));
} else {
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', itemTagName, $.proxy(this.mouseenter, this))
Expand Down

0 comments on commit e239571

Please sign in to comment.