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

Enable and Disable on Responsive view #1

Closed
sydmeeran opened this issue May 7, 2020 · 3 comments
Closed

Enable and Disable on Responsive view #1

sydmeeran opened this issue May 7, 2020 · 3 comments

Comments

@sydmeeran
Copy link

When switching between mobile and desktop, disable and enabling is not working.

@kovart
Copy link
Owner

kovart commented May 9, 2020

Hi!
Could you send the example code with the reproduction of this issue?

@sydmeeran
Copy link
Author

Hi,

if ($(window).width()  > 990) {
    if ($('.js-sticky-widget').length) {
        var stickyElements = Sticksy.initializeAll('.js-sticky-widget', {topSpacing: 120, listen: true})
    }
}

function onResizeStickySection() {
if ($(window).width() < 991) {
if ($('.js-sticky-widget').length) {
// Sticksy.disableAll();
var stickyElements = Sticksy.disableAll();
}
} else {
if ($('.js-sticky-widget').length) {
Sticksy.enable();
}
}
}

$(window).on('resize', onResizeStickySection);

Issue:
When resizing the browser window manually, I could not reinitialize the sticky elements.

@kovart
Copy link
Owner

kovart commented May 26, 2020

Sticksy is a Global object. Unfortunately, it still doesn't have enableAll method. I think I can implement it on this weekend.
In your case, you just call 'enable' static method which doesn't exists. enable() and disable() methods available only for Sticksy instances .
Currently, you can turn them on manually with foreach loop.

@kovart kovart closed this as completed Mar 8, 2021
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