Site logo

Archived topic

Smooth Scrolling (PHP snippet) not working for bbpress

5 replies · Started by Zee on March 12, 2021

Viewing posts 1–6 of 6

Hi there,

It depends on what the Create Post element is. Is it an <a> tag?

I can't see Create Post link unfortunately - Might need to log in to see it.

It just adds #new-post to the end, i.e. https://300hours.com/forum/cfa/level-1/#new-post.

So when 'Create Post' is clicked, it just jumps to the reply form at the end of the page, rather than smoothly scrolling down.

Yes, it needs a login - I've provided some login details below.

Hmm I'm not sure why that's not working unfortunately.

You will need to check with bbPress' support to see if there is anything from their plugin that's blocking the code from being executed.

Another method is to ask them if there is a way to filter the markup of the button so you can add the class manually:
https://docs.generatepress.com/article/smooth-scroll/#regular-links

I just used CSS:

html {
  scroll-behavior: smooth;
}

Is there any reason why GeneratePress doesn't recommend this from the start? Using a snippet doesn't seem as simple as CSS, but maybe I'm missing something...

I don't think scroll-behavior is a new thing and not quite widely supported yet.

This archived topic is closed to new replies.