scrollTop in FullScrenn jQuery

0

On screen in normal mode use at the click of a button the targeting of the screen to a div at the top:

$('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);

But, having the screen in full screen how to make this function work?

link

    
asked by anonymous 04.09.2018 / 03:19

3 answers

0

Resolved,

Simply by using:

$('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);

I was assigning to the scroll of the body, but should be assigning to the scroll of the div that is in fullscreen, getting:

$('#leitor').animate({
    scrollTop: $(".backTop").offset().top
}, 150);
    
07.09.2018 / 05:28
1

To solve your problem simply replace the code: $('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);

For this $('#leitor').animate({scrollTop:$('.leitor_top').offset().top}, 150);

For those who are in full screen is the div called "reader". I hope I have helped!

    
12.09.2018 / 22:55
0

Try this:

var suaDiv = document.getElementById("leitor");
        suaDiv.scrollTop = 0;
    
07.09.2018 / 05:13