Skip to content

Instantly share code, notes, and snippets.

View liamshort's full-sized avatar
🇬🇧

Liam Short liamshort

🇬🇧
View GitHub Profile
@liamshort
liamshort / gist:7a268565453103011d43c6c2d8b89478
Last active March 19, 2025 21:42
This script dynamically creates and displays random text elements on a web-page at random positions. It retrieves keywords from the '<meta name="keywords">' tag, splits them into an array, and periodically selects a random keyword to display. Each text element is styled as a 'div' with the class 'dynamic-text', positioned randomly within the vie…
// Get meta keywords
const metaKeywords = document
.querySelector('meta[name="keywords"]')
.getAttribute("content");
const words = metaKeywords.split(", ");
const body = document.body;
function createRandomText() {
const text = document.createElement("div");
text.className = "dynamic-text";