I am developing a website using scrolling parallax, only one long website page, divided into slides.
The first slide to fit on the screen is the main menu with menus: about us, contact and so on then the rest of the slides also fit on the screen.
If I want to click about us
my website can smooth scroll navigate to about us belowthe first slide and should navigate to the center on the targeted element and that is vertically centered on the screen.
The HTML is
<a href="#aboutuscontents" class="active" title="Next Section" >Slide 1</a>
and I think on this line on jquery:
var targetOffset = $target.offset().top but i'm not sure with it
is responsible for that, but I don't know
how to center it because no center available to it only top and left
The problem is, when navigating, the topmost part of element will stick to the edge of the top of screen using targetOffset.|
to this link: jQuery - Scroll element to the middle of the screen instead of to the top with an anchor link this is same with my problem and the link clearly states what my problem is, and in the line offset = elOffset - ((windowHeight / 2) - (elHeight / 2)); it answers my question.
thank you