Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 288f7f67 authored by 65160392's avatar 65160392
Browse files

Edit main.js

parent 661c778f
No related branches found
No related tags found
No related merge requests found
// Project Management System JavaScript functions // Add fade-in animation to elements
// Auto-dismiss alerts after 5 seconds
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// Auto-dismiss alerts // Add fade-in animation to cards
setTimeout(function() { const cards = document.querySelectorAll('.card');
const alerts = document.querySelectorAll('.alert'); cards.forEach((card, index) => {
alerts.forEach(function(alert) { card.style.opacity = '0';
const bsAlert = new bootstrap.Alert(alert); card.style.animation = `fadeIn 0.5s ease forwards ${index * 0.1}s`;
bsAlert.close(); });
// Add hover effect to project cards
const projectCards = document.querySelectorAll('.project-card');
projectCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-5px)';
this.style.boxShadow = '0 8px 15px rgba(0,0,0,0.1)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0)';
this.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)';
});
});
// Add smooth scroll behavior
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Add loading animation to buttons
const buttons = document.querySelectorAll('.btn');
buttons.forEach(button => {
button.addEventListener('click', function() {
this.style.transform = 'scale(0.95)';
setTimeout(() => {
this.style.transform = 'scale(1)';
}, 100);
});
}); });
}, 5000);
// Enable tooltips // Add search bar animation
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); const searchBar = document.querySelector('.search-bar');
tooltipTriggerList.map(function (tooltipTriggerEl) { if (searchBar) {
return new bootstrap.Tooltip(tooltipTriggerEl); searchBar.addEventListener('focus', function() {
this.style.transform = 'translateY(-2px)';
this.style.boxShadow = '0 8px 15px rgba(0,0,0,0.1)';
}); });
// Enable popovers searchBar.addEventListener('blur', function() {
const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')); this.style.transform = 'translateY(0)';
popoverTriggerList.map(function (popoverTriggerEl) { this.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)';
return new bootstrap.Popover(popoverTriggerEl); });
}
// Add table row hover effect
const tableRows = document.querySelectorAll('.table-hover tbody tr');
tableRows.forEach(row => {
row.addEventListener('mouseenter', function() {
this.style.backgroundColor = 'rgba(92, 107, 192, 0.05)';
this.style.transition = 'all 0.3s ease';
});
row.addEventListener('mouseleave', function() {
this.style.backgroundColor = '';
});
});
// Add task item animation
const taskItems = document.querySelectorAll('.task-item');
taskItems.forEach(item => {
item.addEventListener('mouseenter', function() {
this.style.transform = 'translateX(5px)';
this.style.boxShadow = '0 8px 15px rgba(0,0,0,0.1)';
});
item.addEventListener('mouseleave', function() {
this.style.transform = 'translateX(0)';
this.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)';
});
});
// Add stat card counter animation
const statValues = document.querySelectorAll('.stat-value');
statValues.forEach(value => {
const target = parseInt(value.textContent);
let current = 0;
const increment = target / 50;
const duration = 1000;
const step = duration / 50;
const counter = setInterval(() => {
current += increment;
if (current >= target) {
value.textContent = target;
clearInterval(counter);
} else {
value.textContent = Math.round(current);
}
}, step);
}); });
}); });
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment