I need to add the function when the scroll bar reached the particular div.
How to check the scroll bar reached the particular div
Assuming you have such markup
<div>
<div id="one">One and first</div>
<div id="two">Two</div>
<div id="three">Three and last</div>
</div>
Using vanilla JS, this can be done to save the position of your target element, I targeting #two, and then test current scrolling offset if it reaches the target position.
const ofsetOfTwo = document.getElementById('#two').offset().top;
window.onscroll = function(e) {
if (window.scrollY === divTowPosition) {
//Do stuff...
}
}