Update Just saw your comment, glad you got it working in a more succinct way.
Make the element in the foreground invisible, then use scrollIntoView().
...Something like jse.executeScript('arguments[0].style.visibility="hidden"', element)
?
My Python solution, it should translate easily:
def makeInvisible(driver, element):
driver.execute_script('arguments[0].style.visibility="hidden"', element)
I usually get the element by xpath and then pass it to that function. You can also double-check if something is hidden with an equivalent for:
def isInvisible(driver, element):
return driver.execute_script('return window.getComputedStyle(arguments[0]).display === \'none\'', element)
And of course write a function to make an element visible again with the above.
Hope that helps!