Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/10/2018, 18:31
alvaro_trewhela
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: hacer scroll en pagina

Puedes obtener el scrollY y el height de window, y las coords de c/elemento y si el scrollY+height del window es mayor o igual al elemento.y muestras:


entonces haces esto

Código Javascript:
Ver original
  1. window.onscroll=function(){
  2. var items = [/*put your elems here*/]; //put your items to show when is vissible
  3.     for(var k=0;k<items.length;k++){
  4.         if(window.scrollY+window.innerHeight >= getOffset(items[k]).y){
  5.         //do something to display the items[k]
  6.         }
  7.     }
  8. }
  9.  
  10. function getOffset(el) { //function that get xy of the the element el
  11. var r = el.getBoundingClientRect();
  12. return { x: r.left + window.scrollX, y: r.top};
  13. }

No se que tanto sirve no lo probé