vendor/assets/js/foundation.dropdown.js.es6 in foundation-rails-6.2.3.0 vs vendor/assets/js/foundation.dropdown.js.es6 in foundation-rails-6.2.4.0
- old
+ new
@@ -39,11 +39,11 @@
* @private
*/
_init() {
var $id = this.$element.attr('id');
- this.$anchor = $(`[data-toggle="${$id}"]`) || $(`[data-open="${$id}"]`);
+ this.$anchor = $(`[data-toggle="${$id}"]`).length ? $(`[data-toggle="${$id}"]`) : $(`[data-open="${$id}"]`);
this.$anchor.attr({
'aria-controls': $id,
'data-is-focus': false,
'data-yeti-box': $id,
'aria-haspopup': true,
@@ -69,13 +69,14 @@
* @returns {String} position - string value of a position class.
*/
getPositionClass() {
var verticalPosition = this.$element[0].className.match(/(top|left|right|bottom)/g);
verticalPosition = verticalPosition ? verticalPosition[0] : '';
- var horizontalPosition = /float-(\S+)\s/.exec(this.$anchor[0].className);
+ var horizontalPosition = /float-(\S+)/.exec(this.$anchor[0].className);
horizontalPosition = horizontalPosition ? horizontalPosition[1] : '';
var position = horizontalPosition ? horizontalPosition + ' ' + verticalPosition : verticalPosition;
+
return position;
}
/**
* Adjusts the dropdown panes orientation by adding/removing positioning classes.
@@ -166,15 +167,17 @@
'resizeme.zf.trigger': this._setPosition.bind(this)
});
if(this.options.hover){
this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown')
- .on('mouseenter.zf.dropdown', function(){
- clearTimeout(_this.timeout);
- _this.timeout = setTimeout(function(){
- _this.open();
- _this.$anchor.data('hover', true);
- }, _this.options.hoverDelay);
+ .on('mouseenter.zf.dropdown', function(){
+ if($('body[data-whatinput="mouse"]').is('*')) {
+ clearTimeout(_this.timeout);
+ _this.timeout = setTimeout(function(){
+ _this.open();
+ _this.$anchor.data('hover', true);
+ }, _this.options.hoverDelay);
+ }
}).on('mouseleave.zf.dropdown', function(){
clearTimeout(_this.timeout);
_this.timeout = setTimeout(function(){
_this.close();
_this.$anchor.data('hover', false);