How to check if an element is off-screen

后端 未结 7 1769
太阳男子
太阳男子 2020-11-27 11:39

I need to check with jQuery if a DIV element is not falling off-screen. The elements are visible and displayed according CSS attributes, but they could be intentionally plac

相关标签:
7条回答
  • 2020-11-27 12:15

    I know this is kind of late but this plugin should work. http://remysharp.com/2009/01/26/element-in-view-event-plugin/

    $('p.inview').bind('inview', function (event, visible) {
    if (visible) {
      $(this).text('You can see me!');
    } else {
      $(this).text('Hidden again');
    }
    
    0 讨论(0)
提交回复
热议问题