adding method to check if an element is within the viewport