Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
INSAENSLyon1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2023 Competition
INSAENSLyon1
Merge requests
!9
Resolve "[Page] Complete home page"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "[Page] Complete home page"
11-page-complete-home-page
into
main
Overview
0
Commits
2
Pipelines
1
Changes
5
Merged
Quentin Duvert
requested to merge
11-page-complete-home-page
into
main
1 year ago
Overview
0
Commits
2
Pipelines
1
Changes
5
Expand
Closes
#11 (closed)
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
42d8b016
2 commits,
1 year ago
5 files
+
338
−
48
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
static/script.js
+
29
−
0
Options
// Function to replace class "A" with "B"
function
replaceClass
(
element
)
{
element
.
classList
.
add
(
'
numbers__window__digit
'
);
element
.
classList
.
remove
(
'
A
'
);
}
// Function to handle the intersection
function
handleIntersection
(
entries
,
observer
)
{
entries
.
forEach
(
entry
=>
{
if
(
entry
.
isIntersecting
)
{
// Element is on screen, replace class
replaceClass
(
entry
.
target
);
// Stop observing this element to avoid unnecessary replacements
observer
.
unobserve
(
entry
.
target
);
}
});
}
// Create an Intersection Observer
const
observer
=
new
IntersectionObserver
(
handleIntersection
,
{
threshold
:
0.5
,
// Adjust the threshold as needed
});
// Find all elements with class "A" and observe them
const
elements
=
document
.
querySelectorAll
(
'
.A
'
);
elements
.
forEach
(
element
=>
{
observer
.
observe
(
element
);
});
\ No newline at end of file
Loading