Así que pido su ayuda por favor para saber como posicionar la pagina en el punto cero del scroll vertical después de haberse recargado (sin importar el punto en que se encontrara antes) y que se mantenga allí.
PD : lo probé en firefox y fue el único navegador que si logro funcionar realmente
Código:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Mover Imagen</title> <script src="JQuery.js"></script> <script> var mov = -100; var str = 0; $(document).on('ready',function() { /*************/ $(window).scrollTop(0); //<<---- con o sin JQuery no eh logrado hacer que funcione este metodo o sus parecidos $(window).on('scroll',movimiento); }); function movimiento() { var vtn = $(window).scrollTop(); if(vtn > str){ $('.ver').html('cuando entran <br> vtn = '+vtn+' , str = '+str);// mov += 10; $('.img').css({ 'background-position':'0 '+mov+'px' }); str = vtn; $('.ver').append('<br> cuando sale <br> vtn = '+vtn+' , str = '+str+'<br> valor de posicion : '+mov);// }else if (vtn < str){ $('.ver').html('cuando entran <br> vtn = '+vtn+' , str = '+str);// mov -= 10; $('.img').css({ 'background-position':'0 '+mov+'px' }); str = vtn; $('.ver').append('<br> cuando sale<br> vtn = '+vtn+' , str = '+str+'<br> valor de posicion : '+mov);// } } </script> <style> body{ height:1000px; } .img{ width:100%; height:300px; border:solid; background-image:url(owl.jpg); background-size: 100% 700px; background-position:0 -100px; transition:1s all; } .ver{ width:200px; height:100px; position: fixed; background-color: #FFC107; } </style> </head> <body> <div class="img"></div> <div class="ver"></div> </body> </html>