Check if div is viewable in window?

前端 未结 5 1360
庸人自扰
庸人自扰 2021-01-04 05:33

I have a one page site with fixed navigation and using a scroll script, very similar to this: http://www.ivanjevremovic.in.rs/live/temptation/single/orange/index-cycle-slide

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 06:22

    Use $('#element').offset().top; to detect element top side.

    $(window).scrollTop(); to detect current scroll position.

    And $(window).height(); to detect current window height.

    And after that steps you actually need only something easy math calculations.

提交回复
热议问题