Skip to content

Commit 92f484f

Browse files
committed
removed answer code from index-START.html Ex 13
1 parent 3e73c6f commit 92f484f

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

‎13 - Slide in on Scroll/index-START.html‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,6 @@ <h1>Slide in on Scroll</h1>
5858
};
5959
}
6060

61-
constsliderImages=document.querySelectorAll('.slide-in');
62-
63-
functioncheckSlide(e){
64-
sliderImages.forEach(sliderImage=>{
65-
// half way through the image
66-
constslideInAt=(window.scrollY+window.innerHeight)-sliderImage.height/2;
67-
// bottom of the image
68-
constimageBottom=sliderImage.offsetTop+sliderImage.height;
69-
constisHalfShown=slideInAt>sliderImage.offsetTop;
70-
constisNotScrolledPast=window.scrollY<imageBottom;
71-
if(isHalfShown&&isNotScrolledPast){
72-
sliderImage.classList.add('active');
73-
}else{
74-
sliderImage.classList.remove('active');
75-
}
76-
});
77-
}
78-
79-
window.addEventListener('scroll',debounce(checkSlide));
80-
8161
</script>
8262

8363
<style>

0 commit comments

Comments
(0)