I'd like to add an effect on a page that I'm working on. On it there's a cover with a fixed image and after there's a container. What I'd like to do would be to have the page scrolling with the fixed image just when the user scrolls with his mouse.
I thought something really simple like that, since it works when I put onclick
and not onscroll
but of course it doesn't work:
<div class="cover" onscroll="window.location = '#container';">
...
</div>
<div class="container" id="container">
...
</div>
Basically I'd like something like that, but with the image staying at the same place and the same size: https://tympanus.net/Development/ArticleIntroEffects/
Someone has a solution?
Thanks!
onscroll
runs when content within the element scrolls, so unless there is content inside of thatdiv
, that will never get called. It's a bit confusing what you want. It sounds like you just want to have a fixed background image (since you want it to stay "in the same place and the same size"), but then you show this completely different effect...<img>
tag)