Jquery gets the scroll bar to scroll to a certain position

how do I use jquery to get the absolute position where the scroll bar scrolls to one of the div on the page?

             <div class="page-warp">
                    <div class="page page-one">
                        <div class="left-features">
                            page-one
                        </div>
                        <div class="right-lock">
                            <div class="ul1-lock">
                                <img src="img/door_lock.png"/>
                            </div>
                        </div>
                    </div>
                    <div class="page page-two">
                        <div class="left-features">
                            page-two
                        </div>
                        <div class="right-lock">
                            <div class="ul1-lock">
                                <img src="img/door_lock.png"/>
                            </div>
                        </div>
                    </div>
                    <div class="page page-three">
                        <div class="left-features">
                            page-three
                        </div>
                        <div class="right-lock">
                            <div class="ul1-lock">
                                <img src="img/door_lock.png"/>
                            </div>
                        </div>
                    </div>
                </div>

for example, when you want to get scrolling to page-two, you need to execute a method. I wrote this:

var itemTwo = $(".page-two").offset().top;

but I can"t tell if itemTwo is the location of page-two?
what should I do?

Mar.15,2021

I don't have a special understanding of the problem. Just tell me what I understand:

var itemTwo = $('.page-two'). Offset (). Top;
now that the height of the srcollTop has been obtained, listen for the position of the scroll bar. When if this height, call the corresponding fn

.
Menu