Hello,
I'm on OC 3.0.2.0 and i've te following problem:
I have a couple if anchors on the left side of my page and on the right side i have my text and where the anchors point to.
But when i click on the anchor
link:
<p><a href="#C4">Jump to Chapter 4</a></p>
anchor:
<h2 id="C4">Chapter 4</h2>
When i do this then i go to my homepage.
Could somebody help me with this problem, i have found some posts but none are working for me.
kind regards,
Ben
It will be because of base href tag in your head section. Anchors will not work unless you specify full URL
e.g. https://www.yoursite.com/some-seo-url#some-anchor
e.g. https://www.yoursite.com/some-seo-url#some-anchor
In that case, probably an easier method would be to use Javascript/jquery in the product twig file
So you link and anchor would be:
link:
<p><a href="javascript:void(0);" class="C4">Jump to Chapter 4</a></p>
anchor:
<h2 id="C4">Chapter 4</h2>
Don’t forget to clear your caches (admin - Dashboard - Click cog top-right)
So you link and anchor would be:
link:
<p><a href="javascript:void(0);" class="C4">Jump to Chapter 4</a></p>
anchor:
<h2 id="C4">Chapter 4</h2>
Code: Select all
<script>
$(".C4").click(function() {
$('html, body').animate({
scrollTop: $("#C4").offset().top
}, 2000);
});
</script>
Who is online
Users browsing this forum: DesignCart, sidclel and 94 guests