مدیاویکی:Common.js: تفاوت میان نسخهها
از ویکی معرفت
More languages
More actions
Nazarzadeh (بحث | مشارکتها) صفحه را خالی کرد برچسبها: خالی کردن واگردانی دستی |
Nazarzadeh (بحث | مشارکتها) بدون خلاصۀ ویرایش |
||
| خط ۱: | خط ۱: | ||
/* fade in effect*/ | |||
const fadeElements = document.querySelectorAll('.fadein'); | |||
const observer = new IntersectionObserver((entries) => { | |||
entries.forEach(entry => { | |||
if (entry.isIntersecting) { | |||
entry.target.classList.remove('fadein'); | |||
entry.target.classList.add('fadedin'); | |||
} | |||
}); | |||
}, { | |||
threshold: 0.1, // 10% المنت وارد viewport شود | |||
rootMargin: '0px 0px -10% 0px' // کمی قبل از کامل ورود | |||
}); | |||
// مشاهده تمام المنتها | |||
fadeElements.forEach(el => observer.observe(el)); | |||
نسخهٔ ۲۸ نوامبر ۲۰۲۵، ساعت ۱۹:۴۱
/* fade in effect*/
const fadeElements = document.querySelectorAll('.fadein');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.remove('fadein');
entry.target.classList.add('fadedin');
}
});
}, {
threshold: 0.1, // 10% المنت وارد viewport شود
rootMargin: '0px 0px -10% 0px' // کمی قبل از کامل ورود
});
// مشاهده تمام المنتها
fadeElements.forEach(el => observer.observe(el));