- This topic has 11 replies, 4 voices, and was last updated 1 week, 6 days ago by David.
January 14, 2022 at 1:31 pm #2080632Greg
Is there anyway of adding a class to a regular text link in the page editor? I’ve created a block with page contents (for longer form content) and wanted to apply the smooth scroll class to the links – but can’t figure out how to go about it.
GregJanuary 14, 2022 at 1:43 pm #2080644LeoStaffCustomer SupportJanuary 14, 2022 at 2:36 pm #2080678Greg
Thanks, but no, not the headline block.
It’s a block within a grid that I’ve created to make a sidebar-like Contents block.
Hopefully this screenshot helps to explain better:
GregJanuary 14, 2022 at 2:42 pm #2080686YingStaffCustomer Support
The additional CSS classes are added the the entire
ul(list block), instead of the individual
I would suggest using GB’s Buttons block instead of the list block.January 14, 2022 at 2:57 pm #2080693Greg
Thanks, so it’s not possible to apply them to the individual
liin this instance? Do you know the CSS for the smooth-scroll, so I could apply it to the entire block with custom CSS instead?
GregJanuary 14, 2022 at 3:17 pm #2080706YingStaffCustomer Support
so it’s not possible to apply them to the individual li in this instance?
There’s a workaround, you can edit the list block as HTML, then add the
smooth-scrollclass manually to the link (
Do you know the CSS for the smooth-scroll, so I could apply it to the entire block with custom CSS instead?
Smooth scroll is using JS instead of CSS..
Let me know if this helps 🙂January 14, 2022 at 4:00 pm #2080726Greg
Thanks for the suggestion Ying, the only issue with that is that my client will be editing these blocks in the future – and they’re not comfortable with editing HTML.
Do you have any other ideas for a possible workaround?
GregJanuary 15, 2022 at 3:36 am #2080993DavidStaffCustomer Support
simplest solution would be to make all links attract the smooth scroll behaviour. So there is no need to add classes to the link – this doc explains how:January 15, 2022 at 4:34 am #2081052Greg
Thanks David, I’ve added the snippet (set to run everywhere), removed my custom CSS classes, cleared the cache, and double checked smooth scroll is ticked in the Customiser > General.
But, I’m still not seeing the smooth scroll, any idea what I might be missing?
GregJanuary 15, 2022 at 4:38 am #2081056DavidStaffCustomer SupportJanuary 15, 2022 at 5:31 am #2081087Greg
Thanks David, I had emptied the cache with inspect element + right click on refresh, but clearing it fully has sorted it.
Thanks for the help everyone 🙂
GregJanuary 15, 2022 at 5:48 am #2081096
- You must be logged in to reply to this topic.