Scroll to section Hello guys,
I have problem with scroll to section. Here is my code:
navbar.blade.php
<li><a href="{{ URL::to('/') }}#contact" class="smoothScroll">CONTACT</a></li>
index.blade.php
<section id="contact">
</section>
if I go to any subpage, the CONTACT button takes me to the index page to the contact section but if I'm on the index page, the button above doesn't work. What is wrong?
Thanks for help!
If you look at the source for its probably just
<li><a href="http://yoursite.com/#contact" class="smoothScroll">CONTACT</a></li>
So you are not specifying an actual page to load.
I'm not saying its the right answer, but does it work ok with;
<li><a href="{{ URL::to('/index.php') }}#contact" class="smoothScroll">CONTACT</a></li>
now is other problem :P
My URL looks like:
http://localhost/index.php/index.php#contact
after multiple clicking on button.
<li><a href="/index.php#contact" class="smoothScroll">CONTACT</a></li>
Not sure how you can avoid this, but its not ideal solution.
I removed class smoothScroll, and changed URL to
{{ URL::to('/#contact') }}
and it works, but now I dont have smoothScroll effect, but it is small problem :P Thanks Snapey!
Please sign in or create an account to participate in this conversation.