ziben69's avatar

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!

0 likes
4 replies
Snapey's avatar

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>
ziben69's avatar

now is other problem :P

My URL looks like:

http://localhost/index.php/index.php#contact

after multiple clicking on button.

Snapey's avatar
    <li><a href="/index.php#contact" class="smoothScroll">CONTACT</a></li>

Not sure how you can avoid this, but its not ideal solution.

ziben69's avatar

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 or to participate in this conversation.