albertogasparin/Optiscroll

Can't get it working

drvid opened this issue · 3 comments

drvid commented

The instructions seem simple and clear enough, I have tried a few times on a few different documents with the same results... nothing. Here is another example:

https://codepen.io/drvid/pen/vvyNBJ

Any ideas what's wrong? Hopefully any mistakes in my code are easy to spot.

Sorry for this late reply. Is this still relevant? I saw that in the pen you posted css styles are missing. Without those the library won't work properly.

drvid commented

Hi and thanks for the reply. I already had this URL linked for the external CSS in that pen:

https://cdn.jsdelivr.net/npm/optiscroll@3.2.1/dist/optiscroll.css

It was also linked in the head of my offline examples.

After giving the element I wanted scrollbars on, the class optiscroll, it worked as expected. It didn't mention this instruction explicitly in the docs, and it seemed un-intuitive to me that this was a requirement.

Curious, but why not just apply that class in your jQuery function automatically?

Anyways I've updated the pen to demonstrate the working example. Thanks again.

I guess it could make sense. I never thought about it as I use the class .optiscoll as selector.
I'll update the docs to make clear that is a requirement for now 👍