- This topic has 22 replies, 4 voices, and was last updated 4 years ago by
Elvin.
-
AuthorPosts
-
June 24, 2021 at 10:00 pm #1834225
Jenny
Hello,
I just used google, but I didn’t found a solution for my specific question. Can you help me again, please? 🙂
I need a back to previous page Button for my page in the Navigation. I know the Template can do this (in the Blog Section). But how can I activate this in the Navigation?The link is in the private area 🙂
Thanks for your help,
JennyJune 24, 2021 at 10:12 pm #1834233Elvin
StaffCustomer SupportHi there,
I’m not exactly sure what you mean.
For this “back to previous page”, is it a link sending the user to the exact page visited prior to visiting the page much like the browser’s navigation buttons? https://share.getcloudapp.com/rRuj1JmK
Or is it a button that points to a specific page? Let us know.
June 24, 2021 at 10:16 pm #1834238Jenny
exactly what you sayed:
For this “back to previous page”, is it a link sending the user to the exact page visited prior to visiting the page much like the browser’s navigation buttons? 🙂But for my menu
https://ibb.co/LR4V4yrJune 24, 2021 at 11:43 pm #1834299Elvin
StaffCustomer SupportYou can add
back-button
class to theZurück
link on Appearance > Menus.Sample video on how to do it – https://share.getcloudapp.com/4gunKDWE
You then add this script:
<script> let backBtn = document.querySelector(".back-button"); backBtn.addEventListener('click',function(){ window.history.back(); }); </script>
Here’s how to add it – https://share.getcloudapp.com/Wnuxy48Q
Doing this would make the link a “back-button” link.
June 25, 2021 at 1:23 am #1834365Jenny
Thank you Elvin, your Videos are great 💕.
But it seems I make anything wrong. My Button doesn’t work 🧐.
Could you help me again, please?June 25, 2021 at 3:25 am #1834467David
StaffCustomer SupportHi there,
try changing Elvins script to this:
<script> let backBtn = document.querySelector(".back-button"); backBtn.addEventListener('click',function(e) { e.preventDefault(); window.history.back(); }); </script>
June 25, 2021 at 3:03 pm #1835242Jenny
Dear David,
thanks for your answer 💕, I tested it, but – it does´t work.
I´ts not a big problem if there isn’t it a solution, I can find an other solution, if not.Have a nice evening,
JennyJune 26, 2021 at 12:39 pm #1835969Jenny
Hello,
i will try it once more 🙂 has anyone of you an last idea? If not, I will ask my developer.
Thank you ❤️
JennJune 27, 2021 at 5:24 am #1836335David
StaffCustomer SupportSorry we missed your previous topic
Does it work if you add the button to the Page – not in the navigation ?June 27, 2021 at 6:54 am #1836375Jenny
No Problem 🙂
I tried it out
https://www.designhoch10.com/wordpress-webseite-und-laufende-kosten/(zurück – in the Header)
but it doesn’t work. In the URL just stand
https://www.designhoch10.com/wordpress-webseite-und-laufende-kosten/#Maybe the Problem is the #?
June 27, 2021 at 7:27 am #1836406David
StaffCustomer SupportYou can remove the
#
from the button link – GP will just output an empty span in its place.June 27, 2021 at 7:31 am #1836407Jenny
It’s out – but 😆🙈 no reaction of the button. Should I give it to my developer? I don’t want to steal your time 😆
June 27, 2021 at 6:18 pm #1836895Elvin
StaffCustomer SupportI think the eventlistener isn’t applying on the button.
Let’s modify it again. Try this:
<script> let backBtn = document.querySelectorAll(".back-button"); for(i=0; i<backBtn.length; i++){ backBtn[i].addEventListener('click',function(e) { e.preventDefault(); window.history.back(); }); } </script>
If this doesn’t work on your end, can you put the site back up? It’s displaying blank screen on my end.
June 27, 2021 at 9:25 pm #1836966Jenny
thank you Elvin, but – no reaction of the button :/
https://www.designhoch10.com/wordpress-webseite-und-laufende-kosten/The page is online again
June 27, 2021 at 9:39 pm #1836973Elvin
StaffCustomer SupportAh that’s my bad. I pasted the wrong writeup. doh.
I added the version w/o the iteration value.
Let’s add the iteration value
[i]
before the addEventListener.Try this:
<script> let backBtn = document.querySelectorAll(".back-button"); for(i=0; i<backBtn.length; i++){ backBtn[i].addEventListener('click',function(e) { e.preventDefault(); window.history.back(); }); } </script>
See it in action on this sandbox site – https://dev-generate-press.pantheonsite.io/
-
AuthorPosts
- You must be logged in to reply to this topic.