How to use the ember-basic-dropdown/utils/calculate-position function in ember-basic-dropdown

To help you get started, we’ve selected a few ember-basic-dropdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CenterForOpenScience / ember-osf-web / lib / osf-components / addon / components / responsive-dropdown / component.ts View on Github external
calculatePosition(this: ResponsiveDropdown, ...args: any[]): object {
        // On Desktop
        const pos = calculatePosition(...args);
        if (!this.useOverlay) {
            if (pos && pos.style) {
                pos.style.top += 10;
            }
            return pos;
        }

        // Prevent body scroll when modal is open
        document.querySelector('body')!.classList.add('modal-open');

        const [, content] = args;
        const { height: dropdownHeight, width: dropdownWidth } = content.getBoundingClientRect();
        content.style.marginLeft = `${-(dropdownWidth / 2)}px`;
        content.style.marginTop = `${-(dropdownHeight / 2)}px`;
        content.style.top = `${pos.style.top}px`;
        content.style.left = '50%';
github cibernox / ember-basic-dropdown / tests / dummy / app / controllers / public-pages.js View on Github external
calculatePosition() {
    let pos = calculatePosition(...arguments);
    pos.style.top += 3;
    return pos;
  }
});