Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea for auto height #192

Open
MordiSacks opened this issue Apr 18, 2023 · 1 comment
Open

Idea for auto height #192

MordiSacks opened this issue Apr 18, 2023 · 1 comment

Comments

@MordiSacks
Copy link

For anyone trying to achive auto height, I have manged with a simple directive

        app.directive('vuper-auto-height', (el, binding, vnode) => {
            let h = 0;

            el.querySelectorAll('.vueperslide > *').forEach(s => h = s.clientHeight > h ? s.clientHeight : h);

            h = h < el.clientHeight ? el.clientHeight : h;
            vnode.ctx.props.fixedHeight = h + 'px';

            if (!el.id) el.id = '_vps-' + vnode.ctx.uid;

            let style = document.head.querySelector(`style[id='_vps-${vnode.ctx.uid}']`);
            if (!style) {
                style = document.createElement('style');
                style.id = '_vpss-' + vnode.ctx.uid;
                document.head.appendChild(style);
            }
            style.innerHTML = `#${el.id} .vueperslide > * { height: ${h}px}`;
        });

usege

<VueperSlides v-vuper-auto-height>....
@ottz0
Copy link

ottz0 commented Dec 19, 2023

Thanks for that.....That height thing is annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants