Updated element isElementInViewport function to accept container element