Archived topic
How to apply 'smooth-scroll' class within Gutenberg visual editor
5 replies · Started by Whelan on September 7, 2019
I'm wondering if there's a way to apply the smooth-scroll class to a standard button block within the Gutenberg editor?
Within the Block Editor, it's possible to add a class using the "Advanced" field - but this does not apply the class to the "<a" tag, because it's wrapped in a button tag.
See example here:
https://drive.google.com/file/d/1DHKrHg7zTnINf1pLa94iYoHCgnHGNqb3/view?usp=sharing
Hi there,
you can use the PHP filter provided here so all #hrefs will trigger the smooth-scroll function:
https://docs.generatepress.com/article/generate_smooth_scroll_elements/
OK, thanks that seems to be working well. Does it have a negative effect on performance?
It shouldn't :)
Thanks
No problem :)