Notes
Notes - notes.io |
function ScrollHandler(pageId) {
var page = document.getElementById(pageId);
var pageStart = page.offsetTop;
var pageJump = false;
var viewStart;
var duration = 1000;
var scrolled = document.getElementById("scroll");
function scrollToPage() {
pageJump = true;
// Calculate how far to scroll
var startLocation = viewStart;
var endLocation = pageStart;
var distance = endLocation - startLocation;
var runAnimation;
// Set the animation variables to 0/undefined.
var timeLapsed = 0;
var percentage, position;
var easing = function(progress) {
return progress < 0.5
? 4 * progress * progress * progress
: (progress - 1) * (2 * progress - 2) * (2 * progress - 2) + 1; // acceleration until halfway, then deceleration
};
function stopAnimationIfRequired(pos) {
if (pos == endLocation) {
cancelAnimationFrame(runAnimation);
setTimeout(function() {
pageJump = false;
}, 500);
}
}
var animate = function() {
timeLapsed += 16;
percentage = timeLapsed / duration;
if (percentage > 1) {
percentage = 1;
position = endLocation;
} else {
position = startLocation + distance * easing(percentage);
}
scrolled.scrollTop = position;
runAnimation = requestAnimationFrame(animate);
stopAnimationIfRequired(position);
console.log("position=" + scrolled.scrollTop + "(" + percentage + ")");
};
// Loop the animation function
runAnimation = requestAnimationFrame(animate);
}
window.addEventListener("wheel", function(event) {
viewStart = scrolled.scrollTop;
if (!pageJump) {
var pageHeight = page.scrollHeight;
var pageStopPortion = pageHeight / 2;
var viewHeight = window.innerHeight;
var viewEnd = viewStart + viewHeight;
var pageStartPart = viewEnd - pageStart;
var pageEndPart = pageStart + pageHeight - viewStart;
var canJumpDown = pageStartPart >= 0;
var stopJumpDown = pageStartPart > pageStopPortion;
var canJumpUp = pageEndPart >= 0;
var stopJumpUp = pageEndPart > pageStopPortion;
var scrollingForward = event.deltaY > 0;
if (
(scrollingForward && canJumpDown && !stopJumpDown) ||
(!scrollingForward && canJumpUp && !stopJumpUp)
) {
event.preventDefault();
scrollToPage();
}
false; //
} else {
event.preventDefault();
}
});
}
new ScrollHandler("H1");
new ScrollHandler("H2");
new ScrollHandler("H3");
// new ScrollHandler("H4");
// new ScrollHandler("H5");
// new ScrollHandler("H6");
// new ScrollHandler("H7");
// new ScrollHandler("H8");
// new ScrollHandler("H9");
// new ScrollHandler("H10");
// new ScrollHandler("H11");
// new ScrollHandler("H12");
// new ScrollHandler("H13");
// new ScrollHandler("H14");
// new ScrollHandler("H15");
// new ScrollHandler("H16");
// new ScrollHandler("H17");
// new ScrollHandler("H18");
// new ScrollHandler("H19");
// new ScrollHandler("H20");
// new ScrollHandler("H21");
// new ScrollHandler("H22");
// new ScrollHandler("H23");
// new ScrollHandler("H24");
// new ScrollHandler("H25");
// jQuery('.section-shadow:before').css('left','-1000vw');
// jQUery('.section-shadow:before').css('right','-1000vw');
// jQuery('.section-shadow:after').animate({left: '-15vw'}, 0.3);
// jQuery('.ssection-shadow:after').animate({right:'-15vw'}, 0.3);
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team