diff --git a/angular-dropdowns.css b/angular-dropdowns.css
index f0e830f..c4df1f6 100644
--- a/angular-dropdowns.css
+++ b/angular-dropdowns.css
@@ -7,6 +7,10 @@
margin: 0 auto;
padding: 10px;
+ -webkit-user-select:none;
+ -moz-user-select:none;
+ user-select:none;
+
/* Styles */
background: #fff;
border-radius: 7px;
@@ -212,4 +216,4 @@
.wrap-dd-menu .dropdown.active {
opacity: 1;
pointer-events: auto;
-}
+}
\ No newline at end of file
diff --git a/angular-dropdowns.js b/angular-dropdowns.js
index 604b5ac..35f6f81 100644
--- a/angular-dropdowns.js
+++ b/angular-dropdowns.js
@@ -29,7 +29,8 @@ dd.directive('dropdownSelect', ['DropdownService', '$window',
});
};
- var $clickEvent = ('ontouchstart' in $window ? 'touchend' : 'click');
+ // Does not register touchstart events outside of directive scope
+ var $clickEvent = ('click'||'touchstart' in $window);
$element.bind($clickEvent, function (event) {
event.stopPropagation();
DropdownService.toggleActive($element);
@@ -103,7 +104,8 @@ dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window'
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
$scope.labelField = $attrs.dropdownItemLabel || 'text';
- var $clickEvent = ('ontouchstart' in $window ? 'touchend' : 'click');
+ // Does not register touchstart events outside of directive scope.
+ var $clickEvent = ('click'||'touchstart'in $window);
var $template = angular.element([
'
',
'- ',
'',
'{{dropdownMenuItem[dropdownItemLabel]}}',
'',
diff --git a/dist/angular-dropdowns.css b/dist/angular-dropdowns.css
index f0e830f..c4df1f6 100644
--- a/dist/angular-dropdowns.css
+++ b/dist/angular-dropdowns.css
@@ -7,6 +7,10 @@
margin: 0 auto;
padding: 10px;
+ -webkit-user-select:none;
+ -moz-user-select:none;
+ user-select:none;
+
/* Styles */
background: #fff;
border-radius: 7px;
@@ -212,4 +216,4 @@
.wrap-dd-menu .dropdown.active {
opacity: 1;
pointer-events: auto;
-}
+}
\ No newline at end of file
diff --git a/dist/angular-dropdowns.js b/dist/angular-dropdowns.js
index 604b5ac..35f6f81 100644
--- a/dist/angular-dropdowns.js
+++ b/dist/angular-dropdowns.js
@@ -29,7 +29,8 @@ dd.directive('dropdownSelect', ['DropdownService', '$window',
});
};
- var $clickEvent = ('ontouchstart' in $window ? 'touchend' : 'click');
+ // Does not register touchstart events outside of directive scope
+ var $clickEvent = ('click'||'touchstart' in $window);
$element.bind($clickEvent, function (event) {
event.stopPropagation();
DropdownService.toggleActive($element);
@@ -103,7 +104,8 @@ dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window'
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
$scope.labelField = $attrs.dropdownItemLabel || 'text';
- var $clickEvent = ('ontouchstart' in $window ? 'touchend' : 'click');
+ // Does not register touchstart events outside of directive scope.
+ var $clickEvent = ('click'||'touchstart'in $window);
var $template = angular.element([
'
',
'- ',
'',
'{{dropdownMenuItem[dropdownItemLabel]}}',
'',
diff --git a/dist/angular-dropdowns.min.js b/dist/angular-dropdowns.min.js
index 36c50f2..9be84ef 100644
--- a/dist/angular-dropdowns.min.js
+++ b/dist/angular-dropdowns.min.js
@@ -1,4 +1,4 @@
/**
* @license MIT http://jseppi.mit-license.org/license.html
*/
-"use strict";var dd=angular.module("ngDropdowns",[]);dd.directive("dropdownSelect",["DropdownService","$window",function(e,o){return{restrict:"A",replace:!0,scope:{dropdownSelect:"=",dropdownModel:"=",dropdownOnchange:"&"},controller:["$scope","$element","$attrs",function(n,d,t){n.labelField=t.dropdownItemLabel||"text",e.register(d),this.select=function(e){e!==n.dropdownModel&&angular.copy(e,n.dropdownModel),n.dropdownOnchange({selected:e})};var r="ontouchstart"in o?"touchend":"click";d.bind(r,function(o){o.stopPropagation(),e.toggleActive(d)}),n.$on("$destroy",function(){e.unregister(d)})}],template:['
','
{{dropdownModel[labelField]}}','
","
"].join("")}}]),dd.directive("dropdownSelectItem",[function(){return{require:"^dropdownSelect",replace:!0,scope:{dropdownItemLabel:"=",dropdownSelectItem:"="},link:function(e,o,n,d){e.selectItem=function(){e.dropdownSelectItem.href||d.select(e.dropdownSelectItem)}},template:[' - ','',"{{dropdownSelectItem[dropdownItemLabel]}}","","
"].join("")}}]),dd.directive("dropdownMenu",["$parse","$compile","DropdownService","$window",function(e,o,n,d){return{restrict:"A",replace:!1,scope:{dropdownMenu:"=",dropdownModel:"=",dropdownOnchange:"&"},controller:["$scope","$element","$attrs",function(e,t,r){e.labelField=r.dropdownItemLabel||"text";var i="ontouchstart"in d?"touchend":"click",l=angular.element(['"].join(""));l.data("$dropdownMenuController",this);var c=o(l)(e),p=angular.element('');t.replaceWith(p),p.append(t),p.append(c),n.register(c),this.select=function(o){o!==e.dropdownModel&&angular.copy(o,e.dropdownModel),e.dropdownOnchange({selected:o})},t.bind(i,function(e){e.stopPropagation(),n.toggleActive(c)}),e.$on("$destroy",function(){n.unregister(c)})}]}}]),dd.directive("dropdownMenuItem",[function(){return{require:"^dropdownMenu",replace:!0,scope:{dropdownMenuItem:"=",dropdownItemLabel:"="},link:function(e,o,n,d){e.selectItem=function(){e.dropdownMenuItem.href||d.select(e.dropdownMenuItem)}},template:['- ','',"{{dropdownMenuItem[dropdownItemLabel]}}","","
"].join("")}}]),dd.factory("DropdownService",["$document",function(e){var o=e.find("body"),n={},d=[];return o.bind("click",function(){angular.forEach(d,function(e){e.removeClass("active")})}),n.register=function(e){d.push(e)},n.unregister=function(e){var o;o=d.indexOf(e),o>-1&&d.splice(o,1)},n.toggleActive=function(e){angular.forEach(d,function(o){o!==e&&o.removeClass("active")}),e.toggleClass("active")},n}]);
\ No newline at end of file
+"use strict";var dd=angular.module("ngDropdowns",[]);dd.directive("dropdownSelect",["DropdownService","$window",function(e,o){return{restrict:"A",replace:!0,scope:{dropdownSelect:"=",dropdownModel:"=",dropdownOnchange:"&"},controller:["$scope","$element","$attrs",function(o,n,d){o.labelField=d.dropdownItemLabel||"text",e.register(n),this.select=function(e){e!==o.dropdownModel&&angular.copy(e,o.dropdownModel),o.dropdownOnchange({selected:e})};var t="click";n.bind(t,function(o){o.stopPropagation(),e.toggleActive(n)}),o.$on("$destroy",function(){e.unregister(n)})}],template:['','
{{dropdownModel[labelField]}}','
","
"].join("")}}]),dd.directive("dropdownSelectItem",[function(){return{require:"^dropdownSelect",replace:!0,scope:{dropdownItemLabel:"=",dropdownSelectItem:"="},link:function(e,o,n,d){e.selectItem=function(){e.dropdownSelectItem.href||d.select(e.dropdownSelectItem)}},template:['- ','',"{{dropdownSelectItem[dropdownItemLabel]}}","","
"].join("")}}]),dd.directive("dropdownMenu",["$parse","$compile","DropdownService","$window",function(e,o,n,d){return{restrict:"A",replace:!1,scope:{dropdownMenu:"=",dropdownModel:"=",dropdownOnchange:"&"},controller:["$scope","$element","$attrs",function(e,d,t){e.labelField=t.dropdownItemLabel||"text";var r="click",i=angular.element(['"].join(""));i.data("$dropdownMenuController",this);var l=o(i)(e),c=angular.element('');d.replaceWith(c),c.append(d),c.append(l),n.register(l),this.select=function(o){o!==e.dropdownModel&&angular.copy(o,e.dropdownModel),e.dropdownOnchange({selected:o})},d.bind(r,function(e){e.stopPropagation(),n.toggleActive(l)}),e.$on("$destroy",function(){n.unregister(l)})}]}}]),dd.directive("dropdownMenuItem",[function(){return{require:"^dropdownMenu",replace:!0,scope:{dropdownMenuItem:"=",dropdownItemLabel:"="},link:function(e,o,n,d){e.selectItem=function(){e.dropdownMenuItem.href||d.select(e.dropdownMenuItem)}},template:['- ','',"{{dropdownMenuItem[dropdownItemLabel]}}","","
"].join("")}}]),dd.factory("DropdownService",["$document",function(e){var o=e.find("body"),n={},d=[];return o.bind("click",function(){angular.forEach(d,function(e){e.removeClass("active")})}),n.register=function(e){d.push(e)},n.unregister=function(e){var o;o=d.indexOf(e),o>-1&&d.splice(o,1)},n.toggleActive=function(e){angular.forEach(d,function(o){o!==e&&o.removeClass("active")}),e.toggleClass("active")},n}]);
\ No newline at end of file