Disable up/down buttons in the scrollable menu (language menu).

This commit is contained in:
Julia Radzhabova 2017-09-19 12:03:15 +03:00
parent 40cc71ea63
commit a76214961d
2 changed files with 20 additions and 6 deletions

View file

@ -468,14 +468,20 @@ define([
},
onScroll: function(item, e) {
if (this.fromKeyDown) {
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]');
if (this.scroller) return;
menuRoot.find('.menu-scroll.top').css('top', menuRoot.scrollTop() + 'px');
menuRoot.find('.menu-scroll.bottom').css('bottom', (-menuRoot.scrollTop()) + 'px');
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]'),
scrollTop = menuRoot.scrollTop(),
top = menuRoot.find('.menu-scroll.top'),
bottom = menuRoot.find('.menu-scroll.bottom');
if (this.fromKeyDown) {
top.css('top', scrollTop + 'px');
bottom.css('bottom', (-scrollTop) + 'px');
}
top.toggleClass('disabled', scrollTop<1);
bottom.toggleClass('disabled', scrollTop + this.options.maxHeight > menuRoot[0].scrollHeight-1);
},
onItemClick: function(item, e) {
@ -496,6 +502,8 @@ define([
},
onScrollClick: function(e) {
if (/disabled/.test(e.currentTarget.className)) return false;
this.scrollMenu(/top/.test(e.currentTarget.className));
return false;
},

View file

@ -66,6 +66,7 @@
background-color: @dropdown-bg;
height: 16px;
width: 100%;
cursor: pointer;
&.top {
top: 0;
@ -96,5 +97,10 @@
border-left: 3px solid transparent;
}
}
&.disabled {
opacity: 0.3;
cursor: default;
}
}
}