var isTouch = ('ontouchstart' in window || (window.DocumentTouch && document instanceof DocumentTouch)) ? true : false,
pushstart = isTouch ? "touchstart" : "mousedown",
pushend = isTouch ? "touchend" : "mouseup",
pageY;
$(".content")
.bind(pushstart, function(e) {
pageY = e.pageY;
}).bind(pushend, function(e) {
if (e.pageY > pageY) {
// slide down
} else {
// slide up
}
});
$delta = sqrt(($imgR-$r)^2+($imgG-$g)^2+($imgB-$b)^2);
if (!$delta) {
$delta = sqrt(($r-$imgR)^2+($g-$imgG)^2+($b-$imgB)^2);
}
if ($delta >= 2 and $delta <= 2.5) {
$result[$i] = $colors[$i];
}
$colors = array(
'0' => '#ffffff',
'1' => '#ff0000',
'2' => '#ff00ff',
'3' => '#ffff00'
);
А вообще есть уже готовое решение:
FullPage.js
OnePage Scroll