Skip to content

Zadachi Po Matematika Za 4 Klas -

.hero p margin-top: 12px; font-size: 1.2rem; opacity: 0.9; font-weight: 500;

.reset-btn background: #e2e8f0; color: #2d3e50; box-shadow: none;

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>Задачи по математика за 4 клас | Интерактивни упражнения</title> <style> * box-sizing: border-box; margin: 0; padding: 0; zadachi po matematika za 4 klas

.task-question padding: 1.5rem 1.5rem 1rem; font-size: 1.4rem; font-weight: 600; line-height: 1.4; color: #0f172a; min-height: 110px;

.congrats text-align: center; background: #e6f7e6; margin: 0 2rem 2rem 2rem; padding: 0.8rem; border-radius: 50px; font-weight: bold; color: #2b6e2f; </style> </head> <body> <div class="math-lab"> <div class="hero"> <h1> 📐 Задачи по математика <span>4. клас</span> </h1> <p>✏️ Умножение, деление, дроби, логика и мерни единици</p> </div> <div class="stats-bar"> <div class="score-box"> 🏆 Решени задачи: <span id="scoreValue">0</span> / <span id="totalTasksCount">0</span> </div> <div style="display: flex; gap: 12px;"> <button class="new-task-btn" id="refreshAllBtn">🔄 Нови задачи</button> <button class="new-task-btn reset-btn" id="resetProgressBtn">♻️ Нулирай резултата</button> </div> </div> But to keep fresh, we randomize each "new tasks" click

.task-header background: #f8fafc; padding: 1rem 1.5rem; border-bottom: 2px dashed #cbd5e1; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: #475569; display: flex; justify-content: space-between;

// Number of active tasks displayed at once (we want 4 tasks per page for clarity, but can show all? we choose 6 for rich experience) // Better: display 6 tasks at random from bank (or all if less than 6). But to keep fresh, we randomize each "new tasks" click. // But also we want user to solve all visible tasks, then show congrats when all visible solved. // Implementation: We'll store currentTasks array (each task object with additional fields: solved flag, userAnswer, feedback, id) // Each task card is independent. User can check answers. When solved, it's marked correct and can't change? Actually we allow re-check? // We'll design: once correct -> input disabled and check button disabled or shows ✓. But also reset progress will reset solved flags. // New tasks button will generate fresh set of tasks (random selection from bank, maybe 6 tasks). Reset progress clears solved flags without changing tasks. let currentTasks = []; // active tasks objects extended with id, taskData, solved, userAnswer, feedbackClass, feedbackMsg let globalScore = 0; // number of solved tasks in currentTasks let taskCounter = 0; // simple unique id // DOM elements const tasksContainer = document.getElementById('tasksContainer'); const scoreSpan = document.getElementById('scoreValue'); const totalTasksSpan = document.getElementById('totalTasksCount'); const refreshBtn = document.getElementById('refreshAllBtn'); const resetProgressBtn = document.getElementById('resetProgressBtn'); const congratsDiv = document.getElementById('congratsMessage'); // Helper: check if two answers match (numeric or time string) function isAnswerMatch(userAnswerRaw, correctAnswerRaw, isTimeTask = false) // trim and normalize let userStr = String(userAnswerRaw).trim().toLowerCase(); // For time based tasks like "16:40" also accept "16:40" or "4:40pm"? but we keep simple. if (isTimeTask) // remove spaces and accept both "16:40" and "16,40"? allow "16:40" let normalizedUser = userStr.replace(/[^0-9:]/g, ''); let normalizedCorrect = String(correctAnswerRaw).trim().toLowerCase().replace(/[^0-9:]/g, ''); return normalizedUser === normalizedCorrect; // numeric or decimal let userNum = parseFloat(userStr.replace(',', '.')); // support comma as decimal separator if (isNaN(userNum)) return false; let correctNum = parseFloat(correctAnswerRaw); if (isNaN(correctNum)) return false; // allow tiny floating tolerance for decimals like 4.5 return Math.abs(userNum - correctNum) < 0.0001; // update score UI and check congrats function updateGlobalStats() const solvedCount = currentTasks.filter(t => t.solved).length; globalScore = solvedCount; scoreSpan.innerText = globalScore; totalTasksSpan.innerText = currentTasks.length; if (currentTasks.length > 0 && globalScore === currentTasks.length) congratsDiv.style.display = 'block'; else congratsDiv.style.display = 'none'; // re-render all tasks from currentTasks array (fully rebuild cards) function renderTasks() if (!tasksContainer) return; tasksContainer.innerHTML = ''; if (currentTasks.length === 0) tasksContainer.innerHTML = '<div style="grid-column:1/-1; text-align:center; padding:2rem;">🎯 Натисни "Нови задачи" за да започнеш 🎯</div>'; updateGlobalStats(); return; currentTasks.forEach((task, idx) => ); updateGlobalStats(); // generate random subset from tasks bank (size between 4 and 8, we choose 6 tasks) function getRandomTasks(count = 6) if (TASKS_BANK.length === 0) return []; const shuffled = [...TASKS_BANK]; for (let i = shuffled.length - 1; i > 0; i--) const j = Math.floor(Math.random() * (i + 1)); [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]]; let selected = shuffled.slice(0, count); // ensure variety: if less than count due to bank, duplicate? but bank has 16 items, fine. if (selected.length < count && TASKS_BANK.length >= count) selected = shuffled.slice(0, count); return selected; // create new tasks set (full reset of solved status, fresh questions) function generateNewTasks() const freshTaskBank = getRandomTasks(6); // 6 задачи на екрана за добро разнообразие const newTasksArray = freshTaskBank.map((taskData, index) => return id: taskCounter++, taskData: ...taskData, isTimeBased: taskData.isTimeBased , solved: false, userAnswer: '', feedbackMsg: '⏳ Въведи отговор и натисни "Провери"', feedbackClass: '' ; ); currentTasks = newTasksArray; renderTasks(); // reset only solved flags but keep same tasks function resetProgress() if (currentTasks.length === 0) // if no tasks, maybe generate default ones generateNewTasks(); return; currentTasks = currentTasks.map(task => ( ...task, solved: false, userAnswer: '', feedbackMsg: '⏳ Въведи отговор и натисни "Провери"', feedbackClass: '' )); renderTasks(); // Event handlers refreshBtn.addEventListener('click', () => generateNewTasks(); ); resetProgressBtn.addEventListener('click', () => if (currentTasks.length === 0) generateNewTasks(); else resetProgress(); ); // initial load: generate default 6 interesting tasks function init() generateNewTasks(); init(); </script> </body> </html> User can check answers

.stats-bar display: flex; justify-content: space-between; align-items: center; background: white; padding: 0.9rem 2rem; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; gap: 12px;

/* main card container */ .math-lab max-width: 1300px; width: 100%; background: rgba(255,255,255,0.75); backdrop-filter: blur(2px); border-radius: 3rem; box-shadow: 0 25px 45px -12px rgba(0,0,0,0.25), 0 8px 18px rgba(0,0,0,0.05); overflow: hidden; transition: all 0.2s ease;