Pages

Thursday, 19 December 2024

Reading Time Calculator Tool



Reading Time Calculator

Reading Time Calculator

Estimated Reading Time

0 minutes

© 2024 Reading Time Calculator | Designed with love

/* General Styling */ * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; } body { background-color: #f9f9f9; display: flex; justify-content: center; align-items: center; min-height: 100vh; } .container { background-color: #fff; padding: 30px; border-radius: 15px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); max-width: 600px; width: 100%; } header h1 { text-align: center; font-size: 2rem; color: #4CAF50; margin-bottom: 20px; } .input-section { margin-bottom: 30px; } textarea { width: 100%; padding: 15px; font-size: 1rem; border: 2px solid #ddd; border-radius: 10px; resize: vertical; transition: all 0.3s; } textarea:focus { border-color: #4CAF50; outline: none; } button { background-color: #4CAF50; color: #fff; border: none; padding: 12px 20px; font-size: 1.1rem; cursor: pointer; border-radius: 10px; width: 100%; transition: background-color 0.3s; } button:hover { background-color: #45a049; } .output-section { text-align: center; } .output-section h2 { font-size: 1.5rem; margin-bottom: 10px; color: #333; } #result { font-size: 1.3rem; font-weight: 600; color: #ff9800; } /* Responsive Styling */ @media (max-width: 768px) { .container { padding: 20px; } textarea { font-size: 0.9rem; } button { font-size: 1rem; } #result { font-size: 1.2rem; } } // Function to calculate reading time function calculateReadingTime() { const textInput = document.getElementById('text-input').value; const wordsPerMinute = 200; // Average reading speed const wordCount = textInput.split(/\s+/).filter(function(word) { return word.length > 0; }).length; // Calculate reading time in minutes const readingTime = Math.ceil(wordCount / wordsPerMinute); // Display the result const resultElement = document.getElementById('result'); if (wordCount === 0) { resultElement.textContent = "Please enter some text!"; } else if (readingTime === 1) { resultElement.textContent = `${readingTime} minute`; } else { resultElement.textContent = `${readingTime} minutes`; } }