I got a scrollable page containing a lot of divs. I want to fade out the elements at the top and bottom of the page while the user is scrolling; so only the divs which are currently in the center of the viewport will have an opacity of 100%.

I am currently achieving this by observing the window.scroll event and calculating each divs opacity by their position in relation to the scroll offsets. This works, but has an huge impact on the clients performance (specially when there are a lot of divs) - which leads to a "non fluid" scrolling experience.
Are there other approaches available? Maybe even a solution without going through every single div?
Edit:
- I setup a quick preview on jsFiddle, which illustrates my current approach (not optimized)
- Thanks for you comments! I really like the idea of using a background gradientto fake the elements opacity - but in my case this won't work, because I got anbackground image.
 
    