How to use the dom-align.alignPoint function in dom-align

To help you get started, we’ve selected a few dom-align 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 ecomfe / santd / santd / core / trigger / align.js View on Github external
} = this.data.get();

        if (!disabled && target) {
            const source = this.el;

            let result;
            const element = getElement(target);
            const point = getPoint(target);

            const activeElement = document.activeElement;

            if (element) {
                result = alignElement(source, element, align);
            }
            else if (point) {
                result = alignPoint(source, point, align);
            }

            restoreFocus(activeElement, source);

            // this.fire('align', {source, result});
        }
    }
    /*template: `
github ecomfe / santd / santd / s-trigger / trigger.js View on Github external
forceAlign(source, target, align) {
        const element = getElement(target);
        const point = getPoint(target);
        let result;
        if (element) {
            if (source.style.visibility === '') {
                source.style.visibility = 'hidden';
            }
            result = alignElement(source, element, align);
        } else if (point) {
            result = alignPoint(source, point, align);
        }
    },
    updateDropdownMenu() {
github ecomfe / santd / src / core / trigger / popupInner.js View on Github external
forceAlign() {
        const {
            disabled,
            target,
            align
        } = this.data.get();

        if (!disabled && target) {
            if (target instanceof window.HTMLElement) {
                alignElement(this.el, target, align);
            }
            else if (target && typeof target === 'object') {
                alignPoint(this.el, target, align);
            }

            restoreFocus(document.activeElement, this.el);
        }
    },

dom-align

Align DOM Node Flexibly

MIT
Latest version published 2 years ago

Package Health Score

74 / 100
Full package analysis