Fix stacking context bug caused by opacity

As seen in the article below, both z-index and opacity can create new stacking contexts. Previously, only z-index was accounted for in the parent elements of the targetElement, I've added a bit of code that also accounts for opacity.

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context