lundi 9 mars 2020

Random generator click one per day

I've added a modal with random content (text + image) by clicking a simple link and it works great! But now I'm stuck 'cause I want it to show the same content for 24 hours, no matter how many times users click the link... A quote per day: that would be my point to avoid tons of click from users. Somebody can help me?

(function() {
  var quotes = [{
    text: "...",
    img: "..."
  }, {
    text: "...",
    img: "...",
  }];
  var quote = quotes[Math.floor(Math.random() * quotes.length)];
  document.getElementById("quote").innerHTML =
    '<p>' + quote.text + '</p>' +
    '<img src="' + quote.img + '">';
})();



Aucun commentaire:

Enregistrer un commentaire