Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dramoturg committed Jun 28, 2017
2 parents 312980f + d8d0859 commit ffd9bbc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/js/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ var DropDown = (function(DX) {
'</div>',
'</div>'
].join(''),
hideOnClick: true
hideOnClick: true,
animationStepDelay: 0.03
};

/**
Expand Down Expand Up @@ -91,6 +92,21 @@ var DropDown = (function(DX) {
}
}

function reCalculateAnimationDelay(block, config) {
var listChildren = block.querySelectorAll(`.${CN_OPTION}, .${CN_GROUP_TITLE}`);

for(var i=0; i<listChildren.length; i++) {
listChildren[i].style.animationDelay = config.animationStepDelay * i + 's';
}
}

function reCalculateHeight(block) {
block.style.display = 'block';
var dropDownHeight = DX.Measure.getSize(block, true).height;
block.style.display = '';
block.style.height = dropDownHeight + 'px';
}

function getOptionListHTML(data, config) {
return data.reduce(function(prevValue, item) {
var result = '';
Expand Down Expand Up @@ -259,6 +275,8 @@ var DropDown = (function(DX) {
if (!isShownOnce) {
isShownOnce = true;
reCalculateWidth(block, control, config);
reCalculateAnimationDelay(block, config);
reCalculateHeight(block);
}

setHoveredIndex(0);
Expand Down

0 comments on commit ffd9bbc

Please sign in to comment.