fluidbox-ghost-blog-plugin icon indicating copy to clipboard operation
fluidbox-ghost-blog-plugin copied to clipboard

Warnings on public method close

Open jules-ch opened this issue 5 years ago • 0 comments

I'm getting a tons of warning when scrolling my posts with fluidbox on my ghost instance.

Fluidbox: The method "close" used is not defined in Fluidbox. Please make sure you are calling the correct public method.

It seems to come from this line, when we close after scrolling some pixels. The current selector select even elements that haven't been initialized by fluidbox

if (Math.abs(currentScrollPosition - scrollPosition) > 60)
    $('a').fluidbox('close');

Solution

if (Math.abs(currentScrollPosition - scrollPosition) > 60)
    $('a.fluidbox--opened').fluidbox('close');

Selecting & closing opened element is doing the trick, I'm gonna submit a PR

jules-ch avatar Nov 04 '19 20:11 jules-ch