diff --git a/jade/page-contents/dropdown_content.html b/jade/page-contents/dropdown_content.html index 3843414af4..68898765b4 100644 --- a/jade/page-contents/dropdown_content.html +++ b/jade/page-contents/dropdown_content.html @@ -153,6 +153,12 @@

Options

null Function called when dropdown finishes exiting. + + stopPropagation + Boolean + false + Stop the propagation of a click event for the dropdown trigger + diff --git a/js/dropdown.js b/js/dropdown.js index 5fd0d98668..eedea0c111 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -15,7 +15,8 @@ onOpenEnd: null, onCloseStart: null, onCloseEnd: null, - onItemClick: null + onItemClick: null, + stopPropagation: false }; /** @@ -48,6 +49,7 @@ * @prop {Function} onOpenEnd - Function called when dropdown finishes opening * @prop {Function} onCloseStart - Function called when dropdown starts closing * @prop {Function} onCloseEnd - Function called when dropdown finishes closing + * @prop {Boolean} [stopPropagation=false] - Constrain width to width of the button */ this.options = $.extend({}, Dropdown.defaults, options); @@ -170,6 +172,11 @@ _handleClick(e) { e.preventDefault(); + + if (stopPropagation) { + e.stopPropagation(); + } + this.open(); }