Skip to content

Commit

Permalink
Refactored list-feature.js
Browse files Browse the repository at this point in the history
- Stopped using jQuery
- Moved refactored code to `djangoproject.js`

Not much had to change here because this functionality was already
modernized in 5cad7d2.
  • Loading branch information
adamzap authored and bmispelon committed Jan 28, 2025
1 parent 675ed45 commit 19fd2ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
22 changes: 22 additions & 0 deletions djangoproject/static/js/djangoproject.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,25 @@ document.querySelectorAll('.console-block label').forEach(function (el) {
});
});
});

// Add animation class to feature icons when they are fully visible
(function () {
const observer = new IntersectionObserver(
function (entries) {
entries.forEach(function (entry) {
if (!entry.isIntersecting) {
return;
}

entry.target.classList.add('inview');

observer.unobserve(entry.target);
});
},
{ threshold: 1.0 },
);

document.querySelectorAll('.list-features i').forEach(function (el) {
observer.observe(el);
});
})();
5 changes: 0 additions & 5 deletions djangoproject/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ define(function () {
return !!document.getElementsByClassName(className).length; //return a boolean
}

//feature list
if (hasClass('list-features')) {
mods.push('mod/list-feature');
}

//collapsing list
if (hasClass('list-collapsing')) {
mods.push('mod/list-collapsing');
Expand Down
20 changes: 0 additions & 20 deletions djangoproject/static/js/mod/list-feature.js

This file was deleted.

0 comments on commit 19fd2ec

Please sign in to comment.