Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
165
rated 0 times [  170] [ 5]  / answers: 1 / hits: 20171  / 12 Years ago, wed, june 27, 2012, 12:00:00

I am setting up a website like this (vertical slideshow almost):



http://mikelegacywebdesign.com/scrollpage_test/index.html



The one thing I am looking to do that I can't figure out is how to make the scrolling SNAP to the point where the color change is while scrolling.



For example, when scrolling, you get to about 50-100 px near the top of the next color you are scrolling to, it would be nice if that would snap to that point, instead of just continuing to scroll, because it is hard to get that frame to perfectly align. It's dependent on the user to scroll the perfect amount so that they are viewing the full frame, and not pieces of the former or next frame in the sequence.



Anyone that knows if there is a jQuery plugin or something for this would be my hero.



Here is the ENTIRE page so far. It's simple coding to get the current effect:



<!DOCTYPE HTML>
<html lang=en-US>
<head>
<meta charset=UTF-8>
<title>Scrollpage Test</title>

<style type=text/css>

html, body { margin: 0; padding: 0; height: 100%; width: 100%; }
.container { height: 400%; width: 100%; }
.section { height: 35%; width: 100%; }

#section1 { background-color: #1d9ad7; }
#section2 { background-color: #c83e3d; }
#section3 { background-color: #75b946; }
#section4 { background-color: #f4be2f; }

</style>
</head>
<body>
<div class=container>
<div class=section id=section1></div>
<div class=section id=section2></div>
<div class=section id=section3></div>
<div class=section id=section4></div>
</div>
</body>
</html>

More From » jquery

 Answers
11

Yes, it's possible. Their code is quite awful though. While animating scrollTop, you'll want to make sure that additional user-input that normally leads to scrolling is ignored. Have a look at this test-case to get an idea about how to prevent a user from scrolling.


[#84619] Tuesday, June 26, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
harveys

Total Points: 113
Total Questions: 88
Total Answers: 79

Location: Oman
Member since Fri, Dec 23, 2022
1 Year ago
;