Skip to content

Instantly share code, notes, and snippets.

@jkcgs
Last active January 30, 2020 14:30
Show Gist options
  • Save jkcgs/9081d768bb77574e1f71fa3351a134f4 to your computer and use it in GitHub Desktop.
Save jkcgs/9081d768bb77574e1f71fa3351a134f4 to your computer and use it in GitHub Desktop.
Arregla la posición del contenido al hacer scroll en Diario Financiero
// ==UserScript==
// @name Fix DF.cl scroll
// @namespace http://jgutierrez.cl/
// @version 0.1
// @description Arregla la posición del contenido al hacer scroll en Diario Financiero
// @author Jonathan Gutiérrez <contacto@jgutierrez.cl>
// @match https://www.df.cl/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function upd() {
// El #header es lo que contiene toda la barra flotante superior
// Se le aplica la clase .sticky (la que la posiciona arriba) y se le da
// la propiedad position: sticky, de modo de que el contenido no quede por debajo.
var h = document.querySelector("#header");
h.className = 'sticky';
h.style.position = 'sticky';
}
// Ejecutar al hacer scroll, para asegurar que la otra función no reinicie las propiedades
window.addEventListener('scroll', upd);
upd();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment