1

I tried to look for an answer for long time, but couldn't get close to a reasonable solution. I would like to be able to determine whether an given HTML element is stacked (or rendered) above another arbitrary HTML element. Please note that both elements are completely arbitrary.. there are no constraints on their DOM relation (both can be placed anywhere along the DOM), and their relevant CSS properties ('position', 'z-index' or any other relevant property) can be set to any possible value. Is there any way to determine such thing?

I saw a similar question over here - compare-html-elements-by-actual-z-index, which was left without any answer. So I wish anyone could come up with a solution this time.

Thanks!

Community
  • 1
  • 1
gipouf
  • 1,221
  • 3
  • 15
  • 43
  • if you know z-index of element, i thought you can try something like (with help of jquery) $('element').parentsUntil('offsetparent').length, and you compare :) – AlexDom Jul 04 '14 at 08:37
  • http://stackoverflow.com/questions/12190338/compare-html-elements-by-actual-z-index – JTK Jul 04 '14 at 09:20
  • Alex - I can't assume that the z-index property is defined. – gipouf Jul 04 '14 at 10:25

0 Answers0