Enable and Disable on Responsive view
sydmeeran opened this issue · 3 comments
When switching between mobile and desktop, disable and enabling is not working.
Hi!
Could you send the example code with the reproduction of this issue?
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.
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.