Scrollable Div, which elements can be seen

后端 未结 4 1582
情话喂你
情话喂你 2021-02-06 14:51

We have a scrollable div that has CSS hieght:40px;. Inside it are multiple LI height:20px

    
  • 4条回答
    •  南笙
      南笙 (楼主)
      2021-02-06 15:05

      Update

      Updated with a working example http://jsfiddle.net/U4qyp/32/


      I think .position() should do the job. It gives you the position of the element relative to its parent element. After you called .position() you can access the element coordinates using the properties top and left.

      http://api.jquery.com/position/

      The element whose top position plus its height is major than zero, is visible.

      Here is an example of what I mean.

      http://jsfiddle.net/U4qyp/10/

    提交回复
    热议问题