Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scroll to specific element on page using jquery [duplicate]

Hello am having a great problem scrolling the page to a specific element on page using jquery or javascript.

I've tried many ways of doing it but i failed in all of them. the website is implemented using the framework library called curtain.js https://github.com/victa/curtain.js.

The ways I have tried include:

1)https://developer.mozilla.org/en-US/docs/Web/API/element.scrollIntoView?redirectlocale=en-US&redirectslug=DOM%2Felement.scrollIntoView

2)How to go to a specific element on page?

3) I even tried the simplest way using anchor tags but nothing happens.

the only way that worked was scrollTop() as you can see from other links on the page. Unfortunately this doesn't work for me since this fails on different screen sizes.

you can see example of the site at http://pagota.herobo.com

Thanks !

like image 530
anjelott1 Avatar asked Jun 19 '13 10:06

anjelott1


1 Answers

UPDATE

Try this one, if you want a menu and menu links to specific page. It will scroll to your page with curtain effect.

DEMO http://jsfiddle.net/yeyene/mCytP/2/

Add menu outside of ol, then add links with your li page id in href.

<div id="menu">
    <ul>
        <li><a href="#home" class="curtain-links curtain-links-active">Home</a></li>
        <li><a href="#about_us" class="curtain-links">About Us</a></li>
        <li><a href="#portfolio" class="curtain-links">Portfolio</a></li>
        <li><a href="#programs" class="curtain-links">Programs</a></li>
     </ul>
</div>
like image 108
yeyene Avatar answered Oct 22 '22 05:10

yeyene