Streaming live at 10am (PST)

CMS + JS window.history.go(-1)

Hi,

I started from there.

But managed to sort out everything that I needed. I’ve finally found the time to switch my project from static pages to CMS. Everything went pretty smoothly but I have one single issue which CMS doesn’t allow me to do: Anchor Points.

I searched everywhere on Webflow and in this forum but I can’t seem to put my hand on it. It seems like this option doesn’t exist yet in CMS. Do you have any tricks?

In CMS, the Link box doesn’t allow anything else other than links and we can’t create IDs either. If the Link box was allowing me to add ‘Plain text’ and create specific ID for my data, it would sort the whole thing out. (in theory)

How can I include back this simple interaction?
(An Anchor Point between the image you click on and the page which appears)

The old version of the website is still up here:

While the newest is here:


specifically

When you click on an image, it appears on a separated page on it own. When clicking back you should be arriving to the last image you’ve clicked on. Instead of arriving at the top of the page and having to scroll back down…

Cheers for your help!

Best
Laura


Here is my public share link: LINK
(how to access public share link)

@laurajouan are you familiar with adding anchor links with custom code? With the new code embed options in rich text, that should now be possible.

Hi @sarahfrison,

Thank you for getting back to me. I’ve figured I would be heading toward custom code as I couldn’t create a fix while using ‘plain text’ in either boxes (ID or links).

How should I proceed with the custom code? Where can I get my hands on it? Are you able to supply it for me?

The help would be very much appreciated.

Thanks a lot.

L

@laurajouan hi there! Thanks for waiting. I put together an example for you. I was hoping to use the CMS for more flexibility. I didn’t know dynamic embeds (what you need to link custom code with the cms) aren’t available for rich text fields. I created a project you can clone, this does require you to copy and paste the code each time but it works and that’s the main thing :slight_smile:.


Code at the start of the RTE

Example headline

Example headline

You’ll want replace the ‘example’ with your unique anchor. Let me know if you’ve got extra questions :slight_smile:

Hi Sarah,

Apologises for the slow reply, I was on another project with no time to sit down and have a proper look in your reply. Again thank you for your time and help, I really appreciate.

Your solution looks fine but I would need to manually add embedded details every single time which won’t give absolute control to my client—if I understood your fix well.

While having my eyes off this project, I kept thinking about everything I’ve read about anchor points and link settings on Webflow. I remembered one useful element:
`javascript:window.history.go(-1)

It does help me a little but I still come back at the top of the page. Is there a better version of this specific javascript where I go back precisely where I was? This is the perfect solution to my problem but I would need an upgraded version—not only to the previous page but precisely on the image I’ve clicked on from the previous page.

That’s what I did with the anchor points. To spare people from having to scroll back to where they were on the page before clicking.

I hope I’m making sense.

Best
L

@laurajouan depending on how much you want to teach your client, you could give them a notepad doc with the two codes and instructions on where to implement them when they create a new post.

The javascript you shared does go back, but as you said, just to the previous post. I’m not well-versed in javascript enough to write that out for you. You’d have to be able to have something that remembers where a person clicked and then call that :thinking:

Thank you @sarahfrison for help, I really appreciate it.

One thing is very clear, I can’t ask that from my client. I could have ask her to write down in the CMS system (work/#project-name) but that’s as far as I could go.

Right now, I have the javascript installed as it’s the safest option. I’ve been searching and reading I could learn about the #window.history system and everyone agrees on the need to (1) store the value of my last scroll position in order to (2) get back to it when the #window.history kicks off.

I’ve found jQuery codes but right now, it all looks very obscure to me. I’m trying to make sense of it before even thinking of trying to add the custom codes to my project.

This is one of the element I’ve found.

I’m gonna ask them some clarifications. Regarding the custom code on Webflow, can we place it on targeted pages? In my case, this wouldn’t impact much the website even if it was ruling the whole website.

L