问题描述:

I saw a really cool feature on a site and I want to try to replicate it, but I am having issues figuring out how I could structure it. If you go to the link I provided, you will see that if you scroll your mouse one time it will go to the next div and the previous one will animate out and then then the new one in. I am sure I could figure out the animation, but what I can't figure out is how I would make the window recognize that a scroll means go to the next div. Usually you have to scroll quite a ways for an animation like this to take place.

view it here

Does anyone know how I could do this?

网友答案:

The site utilizes the Multiscroll plugin from here.

It's a neat look, I'd suggest using the plugin before attempting to write a fresh one!

An easy way to detect mobile views in Javascript, taken from this SO answer:

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}

You can then load/not load the plugin appropriately depending on the result of this check.

相关阅读:
Top