Skip to content

Instantly share code, notes, and snippets.

@guibranco
Last active May 19, 2021 15:19
Show Gist options
  • Save guibranco/5899dc16f71bc2586bf8adc70d4d81db to your computer and use it in GitHub Desktop.
Save guibranco/5899dc16f71bc2586bf8adc70d4d81db to your computer and use it in GitHub Desktop.
Exibe um elemento após N segundos - Facebook - https://www.facebook.com/groups/frontendbrasil/permalink/3977507682297954/
const seconds = 30;
const lsKey = "acesso-anterior";
if (localStorage.getItem(lsKey) === null)
setTimeout(showElements, seconds * 1000);
else
showElements();
function showElements() {
localStorage.setItem(lsKey, new Date());
const elems = document.querySelector(".classeAtualASerRemovido");
for (var i = 0; i < elems.length; i++)
elems[i].className = "classeParaExibir";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment