Commit e67c4a6d authored by Phil Hughes's avatar Phil Hughes

changed variable names

parent b808fdf1
...@@ -7,32 +7,32 @@ export const calculateTop = (boundingRect, outerHeight) => { ...@@ -7,32 +7,32 @@ export const calculateTop = (boundingRect, outerHeight) => {
}; };
export const showSubLevelItems = (el) => { export const showSubLevelItems = (el) => {
const $subitems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
if (!$subitems) return; if (!subItems) return;
$subitems.style.display = 'block'; subItems.style.display = 'block';
el.classList.add('is-over'); el.classList.add('is-over');
const boundingRect = el.getBoundingClientRect(); const boundingRect = el.getBoundingClientRect();
const top = calculateTop(boundingRect, $subitems.offsetHeight); const top = calculateTop(boundingRect, subItems.offsetHeight);
const isAbove = top < boundingRect.top; const isAbove = top < boundingRect.top;
$subitems.style.transform = `translate3d(0, ${Math.floor(top)}px, 0)`; subItems.style.transform = `translate3d(0, ${Math.floor(top)}px, 0)`;
if (isAbove) { if (isAbove) {
$subitems.classList.add('is-above'); subItems.classList.add('is-above');
} }
}; };
export const hideSubLevelItems = (el) => { export const hideSubLevelItems = (el) => {
const $subitems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
if (!$subitems) return; if (!subItems) return;
el.classList.remove('is-over'); el.classList.remove('is-over');
$subitems.style.display = 'none'; subItems.style.display = 'none';
$subitems.classList.remove('is-above'); subItems.classList.remove('is-above');
}; };
export default () => { export default () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment