Skip to content

Commit 9b386bb

Browse files
committed
Revert "Refactored list-feature.js"
This reverts commit 19fd2ec.
1 parent 19fd2ec commit 9b386bb

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

djangoproject/static/js/djangoproject.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,3 @@ document.querySelectorAll('.console-block label').forEach(function (el) {
3434
});
3535
});
3636
});
37-
38-
// Add animation class to feature icons when they are fully visible
39-
(function () {
40-
const observer = new IntersectionObserver(
41-
function (entries) {
42-
entries.forEach(function (entry) {
43-
if (!entry.isIntersecting) {
44-
return;
45-
}
46-
47-
entry.target.classList.add('inview');
48-
49-
observer.unobserve(entry.target);
50-
});
51-
},
52-
{ threshold: 1.0 },
53-
);
54-
55-
document.querySelectorAll('.list-features i').forEach(function (el) {
56-
observer.observe(el);
57-
});
58-
})();

djangoproject/static/js/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ define(function () {
99
return !!document.getElementsByClassName(className).length; //return a boolean
1010
}
1111

12+
//feature list
13+
if (hasClass('list-features')) {
14+
mods.push('mod/list-feature');
15+
}
16+
1217
//collapsing list
1318
if (hasClass('list-collapsing')) {
1419
mods.push('mod/list-collapsing');
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
define(['jquery'], function ($) {
2+
const observer = new IntersectionObserver(
3+
function (entries) {
4+
entries.forEach(function (entry) {
5+
if (!entry.isIntersecting) {
6+
return;
7+
}
8+
9+
$(entry.target).addClass('inview');
10+
11+
observer.unobserve(entry.target);
12+
});
13+
},
14+
{ threshold: 1.0 },
15+
); // Trigger when the element is fully visible
16+
17+
$('.list-features i').each(function () {
18+
observer.observe(this);
19+
});
20+
});

0 commit comments

Comments
 (0)