Cycled placeholders
How do I make an cycled placeholders?
What is a cycled placeholders? How do you make a cycled placeholders? This script and codes were developed by Alan Shortis on 22 December 2022, Thursday.
Cycled placeholders - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Cycled placeholders</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <input type="text" id="js--cycle-placeholder" data-placeholder-text="Search by" data-placeholders="Name, Place, Date"> <script src="js/index.js"></script>
</body>
</html>
Cycled placeholders - Script Codes CSS Codes
body { display: flex; align-items: center; justify-content: center; height: 100vh; background: #333;
}
input { background: rgba(255, 255, 255, 0.25); border: 0; padding: .5rem; width: 25%; font-size: 1.25rem; font-family: Helvetica, Arial, sans-serif; color: white;
}
input::placeholder { color: rgba(0, 0, 0, 0.5); transition: color 0.5s ease;
}
input:focus { outline: 0;
}
input.faded::placeholder { color: rgba(255, 255, 255, 0);
}
Cycled placeholders - Script Codes JS Codes
const inputElement = document.getElementById('js--cycle-placeholder');
const placeholderText = inputElement.dataset.placeholderText;
const placeholders = inputElement.dataset.placeholders.split(', ')
let index = 1;
function switchPlaceholder() { if (index === placeholders.length) { index = 0; } inputElement.classList.add('faded'); setTimeout(() => { inputElement.placeholder = `${placeholderText} ${placeholders[index]}...`; inputElement.classList.remove('faded'); index++; }, 500);
}
inputElement.placeholder = `Search by ${placeholders[0]}...`;
setInterval(switchPlaceholder, 2000);
Developer | Alan Shortis |
Username | alanshortis |
Uploaded | December 22, 2022 |
Rating | 3 |
Size | 2,454 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Tooltips | 3,836 Kb |
Subtle animated gradient background | 1,475 Kb |
List filter toggle thing | 2,601 Kb |
Scope Bar | 2,590 Kb |
Toggle Buttons | 3,150 Kb |
Count up | 2,391 Kb |
Responsive Grid | 2,064 Kb |
Orb 2 | 0 Kb |
Dropbox logo with CSS Grid | 0 Kb |
Single div CSS loaders | 2,611 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Long Shadow Button | Uixcrazy | 3,550 Kb |
Using Flickr API | MoyArt | 6,761 Kb |
SVG Scalable Text | Said_FD | 1,451 Kb |
CSS Heart Loaders | Nourabusoud | 2,161 Kb |
Experiment | Toddmoy | 2,849 Kb |
Off Canvas | Mariamarica | 1,870 Kb |
Loading animation with css | Icebob | 2,947 Kb |
Font stack | Adrianjacob | 1,868 Kb |
Glitchy Text Effect | Kescoe | 2,208 Kb |
Responsive Boxes without Images | Andymcfee | 4,120 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!