Ascensor.js icon indicating copy to clipboard operation
Ascensor.js copied to clipboard

Scroll Top

Open Ponyboy47 opened this issue 9 years ago • 3 comments

How would you scroll to the top of a certain Ascensor page? I've tried both window.scrollTo(0,0); && $(div).scrollTop(); Neither work though, understandably, since the actual x, y scroll positions are not 0, 0 for each page

Ponyboy47 avatar Dec 23 '14 18:12 Ponyboy47

I'm not sure exactly what you mean? Could you explain a bit more why you trying to do?

kirkas avatar Mar 29 '15 01:03 kirkas

You talk about "go-to-top" link?

/ HTML / <a class="start-over" href="#">Top</a>

/ Script /

var ascensor = $('#content').ascensor(); var ascensorInstance = $('#content').data('ascensor');

$(".start-over").click(function() { ascensorInstance.scrollToFloor(0); });

kiriniy avatar Apr 01 '15 20:04 kiriniy

what about

var ascensor = $('#content').ascensor();
$(".start-over").click(function() {
    ascensor.trigger("scrollToStage", 0);
})

?

kirkas avatar Apr 01 '15 20:04 kirkas