I am looking for a way put some anchor points inside the CMS rich text.
Example:
I have CMS site with some large rich text block including many paragprahs. I just need to make some anchors to be able directly scroll to the section using the url url.com/page#example_id_scroll
Right… but the issue is, you need to be able to add an ID directly to an html element (RTE elements in this case such as text, titles or images). There is no way to actually do that within the RTE Field in the CMS. So it makes the option of using Javascript pointless when it has nothing to point to and then again, if or when that is possible you wouldn’t need javascript.
Unless…
Lets say we chose a key word like “myMarker-customID” (which you would write in the RTE field in the CMS) and have Javascript scan the RTE element for any text that starts or contains “myMarker-” and then appends an ID value (which directly follows the hi-fen to that text as well as hides it.
I wrote a post on my blog showing how to create a button inside of a rich text element based on a certain condition. This could easily be modified to achieve the same thing that you’re looking for. Here’s the blog post => Buttons in Rich Text Elements in Webflow - WF How with instructions.
Thanks. You can do almost anything with that approach. Yes, I did read your post, that is similar. The issue is not the JS, just coming up with a consistent target.
Hey, i know this is an old post but it’s really easy to achieve nowadays, if you just want to scroll to specific paragraphs or anywhere inside a CMS rich text block.
You have to create a html embed object inside the rich text field in your CMS and create a div block with any id.