0

I have started to build a website, based on the structure from this codpen:

http://bit.ly/1DIHGSy

My problem is, that I want the page to load on to the last slide?

A have tried to make an anchor point, and make the page load to the anchor point, whiteout any luck. I have also tried to make a script based on this post:

jQuery: how to scroll to certain anchor/div on page load?

Again whiteout any luck. Do anyone have an idea on how to solve this issue?

notice: I don't want the user to feel any slide or effect while getting to this location

Community
  • 1
  • 1
cnos
  • 5
  • 1

1 Answers1

1

you call goToSlide($currentSlide); in line 27 that is the first slide, instead do:

goToSlide($('#slide-7'));

but then you'll have the sliding animation so you can upgrade the function to accept duration argument:

function goToSlide($slide, duration)
{

    if(typeof(duration) === 'undefined'){
       duration = 1;
    }

    //...

        TweenLite.to($slidesContainer, duration, {scrollTo: {y: pageHeight * $currentSlide.index() }, onComplete: onSlideChangeEnd, onCompleteScope: this});

    // ...
}

and then in line 27:

goToSlide($('#slide-7'), 0)

or better yet when you defining variable:

var $currentSlide = $slides.first();

make it last slide in the first place:

var $currentSlide = $slides.last();
robert
  • 66
  • 1
  • 3
  • so the goToSlide($('#slide-7')); does work. Thanks But when I try to upgrade the function to accept duration argument, the slide function doesn't seem to work at all. Is there another way to bypass this problem ? – cnos Apr 08 '15 at 10:39