From e239571831fc34af519bd3ef6a93e0baa93f2bf3 Mon Sep 17 00:00:00 2001 From: THIEBAUT Fabrice Date: Sat, 7 Apr 2018 12:33:33 +0200 Subject: [PATCH] 'ontouchstart' condition 'ontouchstart' condition for netbook with touchscreen. --- bootstrap3-typeahead.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bootstrap3-typeahead.js b/bootstrap3-typeahead.js index ab1d7a2..b26b84b 100644 --- a/bootstrap3-typeahead.js +++ b/bootstrap3-typeahead.js @@ -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))