scrollTop in Fullscrenn jQuery

Asked

Viewed 84 times

0

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

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

But, taking the screen on Full Screen how to make this function work?

https://jsfiddle.net/f6xr93b7/

  • You have an answer here you will take a look at it: https://answall.com/questions/1855/existe-alguma-maneira-de-ativar-a-tela-cheia-do-navegador-javascript

  • Good boss, but, my fullscreen is already working, my problem is sending the user to a div at the top of the page when this screen is fullscreen

  • But what would be the difficulty then sNniffer?

  • It doesn’t work here $('html,body').animate({scrollTop:$('.backTop').offset().top}, 150); fullscreen

3 answers

1

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

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

For who stands in full screen is the div called "reader". I hope I’ve helped!

0

Test this:

var suaDiv = document.getElementById("leitor");
        suaDiv.scrollTop = 0;
  • 1

    jewelry? Tested and unsuccessful yet

0


Solved,

Simply by using:

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

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

$('#leitor').animate({
    scrollTop: $(".backTop").offset().top
}, 150);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.