jimmynotjim / scrollnav

A dependency free JavaScript plugin for auto generating single page navigation
http://scrollnav.com
MIT License
461 stars 127 forks source link

Allow customization of CSS classes #100

Closed Spone closed 3 years ago

Spone commented 5 years ago

Hi,

thanks for this library. We plan on using it in an upcoming project. We chose not to follow BEM conventions for naming our classes, and we would like to be able to customize the CSS classes added by scrollnav.

It could be a cssClasses option that would accept an object. This would be similar to the instantsearch.js implementation: https://www.algolia.com/doc/api-reference/widgets/search-box/js/?language=javascript#widget-param-cssclasses

What do you think?

jimmynotjim commented 5 years ago

That sounds really nice on the surface but my main concern would be the complexity added because all the classes are auto-generated from the base class. A good example is the createList function which is used to generate both the section and sub-section lists.

If you're willing to rework things in a way that doesn't add a lot of overhead I'd be open to a Pull Request.

grebaldi commented 5 years ago

How about customizing the base class? I think the major concern here is collisions of multiple instances of scrollnav. Allowing a custom base class would imho solve that problem sufficiently.

jimmynotjim commented 5 years ago

That could work. I used to allow for customizing the base class but removed it in v3 because the custom options were getting out of hand. @grebaldi want to submit a PR?

grebaldi commented 5 years ago

I'll have a look into it @jimmynotjim

jimmynotjim commented 3 years ago

Closing due to lack of time and little interest in this request. If you would like to work on this feature feel free to create a PR and send it my way to look over.