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

Problem partially solved with an accordion #10

Closed
andrea-ferrentino opened this issue Oct 21, 2021 · 2 comments
Closed

Problem partially solved with an accordion #10

andrea-ferrentino opened this issue Oct 21, 2021 · 2 comments

Comments

@andrea-ferrentino
Copy link

andrea-ferrentino commented Oct 21, 2021

Hi, i'm using your plugin on a woocommerce site to sticky the add to cart bar, it works quite good, but i've a problem.

This bar has an accordion inside it, when i open an accordio it goes on overflow and sticky container doesn't move, it update only if i scroll the page back up of about 200px, so i made this script to hardrefresh whene i click on an item in the widget.
it quite works, but obviously it refreshes after some time, so you can see an overflow then after half second it jumps up, obviously i can't hide this overflow cause the sticky element is in absolute position....

can you suggest something? or some bugfix directly to the plugin?
thanks a lot

var stickyEl = new Sticksy('.js-sticky-widget', {
topSpacing: 85,
listen: true
})
stickyEl.onStateChanged = function (state) {
if(state === 'fixed') stickyEl.nodeRef.classList.add('widget--sticky')
else stickyEl.nodeRef.classList.remove('widget--sticky')
}

let timeOut;
jQuery('.js-sticky-widget *').click(function () {
console.log('click');
clearTimeout(timeOut);
timeOut = setTimeout(function () {
console.log('refresh');
stickyEl.hardRefresh();
}, 700)
});

image

@kovart
Copy link
Owner

kovart commented Oct 24, 2021

It's hard to say without code.

Is it possible to send a simplified demo of the situation with the accordions?

@imrantushar
Copy link

imrantushar commented Feb 8, 2022

Hi @kovart
Here is my solution for accordion or tabs

var stickyEl = new Sticksy('.abc-sticky-widget', {
        topSpacing: 60,
    })
    stickyEl.onStateChanged = function (state) {
        if (state === 'stuck') {
            stickyEl.hardRefresh()
        }
    }
   

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

3 participants