0

I want to filter only the a's that are really shown currently in the browser.

I used getBoundingClientRect function, but there are still some cases that I can't filter - like hidden or covered a tags.

Is there a more generic way in pure javascript to know exactly what are the a tags that are really shown currently and the user really can see?

I need it for my chrome extension that uses these tags. So if there is a way to do it using chrome extension API it is a good solution too.

But Mostly the problem is li tags where not all the elements inside the list are shown. How can I know what elements are shown and what not?

Thanks!

Ygandelsman
  • 453
  • 7
  • 16
  • 1
    `href` is an attribute. Do you mean: "I want to filter only the `a` elements that are really shown currently in the browser"? – kmoe Oct 12 '14 at 14:45
  • have to loop over the collection and check style values for `display` and `visibility`. If you want only elements visible in viewport will need to determine offsets also and compare to window dimensions and scrolltop – charlietfl Oct 12 '14 at 15:11
  • Do you want to find them once, or continuously get notified whenever they are "visible" / "hidden"? And what do you actually mean by "shown"? Does that mean that the user can visually observe the element, or something else? – Rob W Oct 12 '14 at 15:39
  • See http://stackoverflow.com/q/25555960/2801559 – guest271314 Oct 12 '14 at 15:57

0 Answers0