|
|
Line 1: |
Line 1: |
| /* Any JavaScript here will be loaded for all users on every page load. */ | | /* Any JavaScript here will be loaded for all users on every page load. */ |
| document.addEventListener('DOMContentLoaded', function() {
| | $('.panel').hover( |
| const panel = document.querySelector('.panel');
| | function(){ $(this).addClass('hovered') }, |
| let hoverTimer;
| | ) |
| | |
| panel.addEventListener('mouseenter', function() {
| |
| hoverTimer = setTimeout(function() {
| |
| panel.classList.add('hovered');
| |
| }, 200); // Delay the flip by 200ms (you can adjust the value)
| |
| });
| |
| | |
| panel.addEventListener('mouseleave', function() {
| |
| clearTimeout(hoverTimer); // Prevent the flip if the mouse leaves before the delay
| |
| panel.classList.remove('hovered');
| |
| });
| |
| });
| |
| document.addEventListener('DOMContentLoaded', function() {
| |
| const panels = document.querySelectorAll('.panel');
| |
|
| |
| panels.forEach(function(panel) {
| |
| // Add class when mouse enters
| |
| panel.addEventListener('mouseenter', function() {
| |
| panel.classList.add('hovered');
| |
| });
| |
| | |
| // Remove class when mouse leaves
| |
| panel.addEventListener('mouseleave', function() {
| |
| panel.classList.remove('hovered');
| |
| });
| |
| });
| |
| });
| |
/* Any JavaScript here will be loaded for all users on every page load. */
$('.panel').hover(
function(){ $(this).addClass('hovered') },
)