Coder Social home page Coder Social logo

alton's Introduction

README

What is Alton?

Alton is a jQuery-powered scrolling plugin that utilizes custom vertical scrolling effects in order to present and navigate through web content in a unique manner. It utilizes the whole scrolljacking idea, but greatly improves upon the often-poorly-implemented scrolljacking experiences you might be used to.

What makes Alton unique?

Good question. Here's why Alton rules:

  1. The Standard functionality. Standard brings you the full page scrolling you're used to by making the "featured area of projects" in the middle section 100% height, and each scroll directs you to the next one (scroll down) or previous (scroll up). Here's a demo of Standard.

  2. The Bookend functionality. This allows you to create a bookend experience which allows you to seamlessly introduce your full height section, and summarize or even conclude it. Here's a demo of Bookend.

  3. The Hero Scroll functionality. This allows you to scrolljack only the "Hero Section", wherein the page will scoll to the top of the section that immediately follows the Hero Section, then re-enable native scrolling for the rest of the page. Here's a demo of Hero Scroll.

  4. The plugin uses 100% height containers for full-screen presentation; it's great for impactful presentation.

  5. You have options for a couple of different layouts right out of the box.

  6. It's lightweight, easy to implement, and not CPU intensive.

What is "ScrollJacking"?

Scrolljacking basically means we replace native scrolling (what you're used to) with targeted scrolling: when the user initiates a scroll, either with their mouse or keyboard, scrolljacking takes them to an exact vertical point on the screen (for example, the top of the next content container). When done properly, scrolljacking can be a part of a unique, enjoyable online experience.

Compatibility

This plugin has been tested on IE9+ and with jQuery 1.7+. Anything less and you're on your own for now โ€“ sorry!

Demos

In case you missed the links above, here are a few demos showing the different ways Alton can be used. You can also take a quick peek under the hood there to see exactly how we're implementing it.

Demo 1 (Standard Implementation)

Demo 2 (with Bookend functionality)

Demo 3 (with Hero Scroll functionality)

Quick start

Standard Functionality

Standard functionality brings you the full page scrolling you're used to. The "featured area of projects" in the middle section are all 100% height, and each scroll directs you to the next one (scroll down) or previous (scroll up). Here's a demo of Standard.

Here is an example for all the options needed for Standard:

First ensure you have the proper HTML structure:

<body class="pageWrapper">
	<section class="full">
		<div class="slide"></div>
		<div class="slide"></div>
		<div class="slide"></div>
	</section>
</body>

Next add the following JavaScript where you want to call it. Note: If you don't want errors to occur, only run the script on the page where scrolling occurs

$(document).alton({
	fullSlideContainer: 'full', // Tell Alton the full height container
	singleSlideClass: 'slide', // Tell Alton the full height slide class
	useSlideNumbers: true, // Set to false if you don't want to use pagination
	slideNumbersBorderColor: '#fff', // Set the outside color of the pagination items (also used for active)
	slideNumbersColor: 'transparent', // Set the inner color of the pagination items (not active)
	bodyContainer: 'pageWrapper', // Tell Alton the body class
});

Bookend Functionality

The Idea behind Bookend functionality is that you have a header and footer sections ("bookends"), with a featured area of projects or something in the middle. The "featured area of projects" in the middle section are all 100% height, whereas the bookends can be whatever height you'd like them to be. Here's a demo of Bookend.

Here is an example for all the options needed for Bookend:

First ensure you have the proper HTML structure:

<body class="pageWrapper">
	<!-- Set the height for bookends. We left this in your hands so choose wisely -->
	<header class="header" style="height:500px;"></header>
	<section class="full">
		<div class="slide"></div>
		<div class="slide"></div>
		<div class="slide"></div>
	</section>
	<footer class="footer" style="height:500px;"></footer>
</body>

Next add the following JavaScript where you want to call it. Note: If you don't want errors to occur, only run the script on the page where scrolling occurs

$(document).alton({
	fullSlideContainer: 'full', // Tell Alton the full height container
	singleSlideClass: 'slide', // Tell Alton the full height slide class
	useSlideNumbers: true, // Set to false if you don't want to use pagination
	slideNumbersBorderColor: '#fff', // Set the outside color of the pagination items (also used for active)
	slideNumbersColor: 'transparent', // Set the inner color of the pagination items (not active)
	bodyContainer: 'pageWrapper', // Tell Alton the body class
});

Hero Scroll

The Idea behind Hero Scroll is that we only apply scrolljacking to the topmost "Hero" container; one scroll movement takes the user to the top of the next section of content and native scrolling is enabled. Here's a demo of Hero Scroll.

Here is an example for all the options needed for Hero Scroll:

First ensure you have the proper HTML structure:

<section class="header">
	<!-- Insert Header Content Here -->
</section>
<section class="pageWrapper">
	<!-- Insert Regular Content Here -->
</section>

Next add the following JavaScript where you want to call it. Note: If you don't want errors to occur, only run the script on the page where scrolling occurs

$(document).alton({
	firstClass : 'header', // Set the first container class
	bodyContainer: 'pageWrapper', // Set the body container
	scrollMode: 'headerScroll', // Set the scroll mode
});

All Available Options

Here's a list of all the options that come built in to Alton, along with their default values.

firstClass : 'header', // classname of the first element in your page content
fullSlideContainer : 'full', // full page elements container for 
singleSlideClass : 'slide', // class for each individual slide
nextElement : 'div', // set the first element in the first page series.
previousClass : null, // null when starting at the top. Will be updated based on current postion
lastClass: 'footer', // last block to scroll to
slideNumbersContainer: 'slide-numbers', // ID of Slide Numbers
bodyContainer: 'pageWrapper', // ID of content container
scrollMode: 'featuredScroll', // Choose scroll mode
useSlideNumbers: false, // Enable or disable slider
slideNumbersBorderColor: '#fff', // outside color for slide numbers
slideNumbersColor: '#000', // interior color when slide numbers inactive

What's included

Bugs and feature requests

Have a bug or a feature request? Please first read the issue guidelines and search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.

Currently Working On

  • Custom Animations
  • More Customization for slide number indicators (pagination)

Keep track of our progress.

Follow @paper_leaf on Twitter.

Copyright and License

Copyright 2014 Paper Leaf Design

License: GPL v3

Frequently Asked Questions

Does this work on touchscreens?

No.

Why not?

Touch events are a different beast, and considering the amount of people on cheaper, less powerful devices, or even the majority still stuck in contracts, the usability is usually non-existent. That being said, we are continuing to explore ways of implementing this for mobile devices.

So you are looking at adding mobile functionality?

Possibly!

What currently happens on mobile devices, then, if Alton doesn't work?

It falls back to regular scrolling on mobile. It's the best of both worlds, like pizza made out of candy.

Scrolling appears unresponsive at times. What's going on?

After every scroll there's a delay in effect to help get rid of Inertia Scroll on Macs. If you try to scroll within this delay it will prevent you from scrolling, until the barrage of mousewheel events has ended.

Why did you name this plugin Alton?

We're playing off the idea of height, in that this plugin uses 100% height containers. That led us to the discovery of Robert Wadlow, the world's tallest man โ€“ also known as the Alton Giant. mic drop

alton's People

Contributors

josephyancey avatar markunthank avatar peterdavehello avatar sebastien-fauvel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alton's Issues

Broken text fields

I would like to use this plugin to navigate a page containing a few forms, but it seems that all keypress events are being handled by the plugin and that their default behavior is prevented... so that you cannot enter anything in text fields! There's a simple fix for that: Removing the default case in:

        onkeydown = onkeyup = function(e) {
            e = e || event; // to deal with IE
            map[e.which] = e.type == 'keyup';
            switch (e.which) {
              case 40: // arrowDown
                e.preventDefault();
                $(document).moveDown(e);
                break;
              // [...]
              default:
              e.preventDefault();
            }
        }

Any objection?

Pressing Down Arrow causes page to scroll all the way back to top

Alton is probably the best scrolling plugin I've seen yet! However, I'm having one issue, when I hit the down arrow on the keyboard to scrolldown, it immediately scrolls me up to the very top of the page, through all previous sections. Have you seen anything like this before?

Space bar for scrolling breaks

I noticed on the bookends example that there is an error when I'm spacing through slides. If get to the bottom and hit "Page Up" to get to the top that it breaks the space bar scrolling.

Thanks! This is a great tool.

Enabling native scrolling on the last slide

Hey y'all!
First of all great plugin! Love it!

I saw a closed issue in this repo, but the problem hasn't been resolved. #20
Can someone help me find the solution for this?
I need something like this: http://www.hugeinc.com/
(no need for hiding the previous slides)

I can try modify this myself, but any help is appreciated!
Thanks! :)

Re-enable Native Scrolling after Featured Section in Bookmark Mode

Firstly, absolutely LOVE this plugin! Great work and thank you so much for sharing it with us.

The issue I have been trying to solve (but sadly, have a hard time moding the JS since I'm very novice) is to try to re-enable native scrolling after my last featured section--then un-enabling it as they scroll up back into the featured section.

I believe this would be a wonderful addition to the plugin--but was wondering if you knew of a work-around in the meantime?

Again, thanks so much--you all are a super team! :)

Alton standard scrolls back to top

I've made a simple html file including jquery.js and jquery.alton.js

Really simple example ripped right off the readme.

Problem: After a short interval (~1s), Alton scrolls back up one section until it reaches the first slide.

Any idea as to why this occurs would be appreciated.

Link for Slide

Can I make a link to a specif slider.
The same way the navigation works.

If I use element id, it works, however the scroll position stays at the last point it scrolled, therefore if I send a user to from the top to the bottom trought id link, when he uses the mouse scroll, the fuction will resume from the top, instead of the current slide.

Scrolling UX Issues in demos

This is pretty awesome. I did notice a few issues with your demos.

  1. When you scroll all the way to the bottom or top the scroll delay before you can change directions makes you feel like the site has broken. Perhaps resetting the scroll delay when you hit the top of bottom will solve this.
  2. If you scroll using the scroll-bar to the bottom of the page, when you scroll up using the scroll wheel it scrolls as if it would without the script, then allows you to scroll down in the same manner. Perhaps its wise to use the scroll position with the scroll-bar to update the target as it goes, that way the same effect can be achieved with a mix of the two scrolling options.
  3. Sometimes when you hit the top or bottom it does legitimately freezing until you refresh.

All-in-all I love what's going on here, im excited to try it out.

Callback?

Hello can we get some callback for function to stop function working (when we use lightbox or fancybox) and after close fancybox start alton again? It's easy to do with fancybox (we got some callbacks on close and open, but how to stop function from website).

customize circle button

i am still newbie in web design, can you please tell me how to modifiy the circle button?? (useSlideNumbers)
.i want to make it customize like at the header or footer
thanks for your attention

Scroll the heroes

Hi there, is it somehow possible to have more than one hero-section (in my case two)?

Excessive delay on scroll

On Certain Devices, (Macbooks, devices with inertia scroll etc), delay will not cease until user has full stopped scrolling for .5s.

Pointed out by a few users on Reddit

Spacebar in Form causes Alton to jump

When a user is entering a form on an Alton slide, and hits the space bar, alton triggers moveDown()

Also look into option for removing keyboard accessibility options and having them do nothing.

Uncaught TypeError

Would love to get this working on site, but keep getting the following js error:

"Uncaught TypeError: Cannot read property 'top' of undefined" - line 300 of alton.js

Am running this on home page of wp site. This is using a group of sections each of which has a full-screen background image being sized thru css, not js. Structure is the following -- seems OK per docs:

<body class="home">
   <div class="site-container">
        <header class="site-header"></header>
        <div class="home-welcome slide"></div>
        <div class="home-featured slide"></div>
        <div class="home-testimonials slide"></div>
        <div class="home-communities slide"></div>
        <footer class="site-footer"></footer>
    </div>
</body>

Here's my init file contents:

jQuery(document).alton({
    bodyContainer: 'home', // Tell Alton the body class
    fullSlideContainer: 'site-container', // Tell Alton the full height container
    singleSlideClass: 'slide', // Tell Alton the full height slide class
    useSlideNumbers: true, // Set to false if you don't want to use pagination
    slideNumbersContainer:"slide-numbers",
    slideNumbersBorderColor: '#fff', // Set the outside color of the pagination items (also used for active)
    slideNumbersColor: 'transparent', // Set the inner color of the pagination items (not active)
    firstClass:"site-header",
    nextElement:"div",
    previousClass:null,
    lastClass:"site-footer",
    scrollMode:"featuredScroll",
    animationType:"slow"
});

Dev site is local, so have nothing to show. Any thoughts on what might be causing this error? Am a js newbie, so very well could be 'user-error'.

Regards, Mark

Alton Standard adds extra navigation dots

I'm using Alton within WP and realise my slides aren't using:
div class="slide slideOne" div class="slide slideTwo"
etc, like the standard demo, but for some reason my nav is adding additional dots.

[UPDATE]: It reads additional divs within the section and applies nav dots for them. Problem solved.

Bower package

Would be great if you make this available as bower package.

Callback Function

I'd like to be able to fire my own JS functions after the scroll effects are done -- this way I could animate additional elements or update other parts of the page.

The most likely place seems to be the scrollDown and scrollUp functions. Is this something you're considering adding?

Can I remove the function of scrolling by number keys on keyboard?

I recently discovered this plugin that I wanted to try designing a login page for learning purposes. With reference to your bookend demo, I plan to use the header as a login page and the footer part as a sign up part, where each section consists of a form with some basic inputs for a user registration page to find out that pressing 1 and 2 would lead me to either the top or bottom of the page that I would find it an issue when the input required for the page that I'm designing to consist of numbers that may consist of 1 or 2. I wonder if it would be possible to remove the function, or may I know how I could remove the function in my own? I'm sorry for my poorly-written description of request.

SideScroll triggers moveDown

Issue pointed out by doedels on reddit.

There seems to be a bug when trying to sidescroll in OSX to go back, it just keeps scrolling down.

Would it be possible to change height to min height?

Hi I was wondering is it possible to change the style height to min-height as on mobile my content for each slide extends beyond the viewport height.

Or is there any other options/settings that can be used to change this happening or is this the wrong plugin for me?

Thoughts on alton on mobile/tablet devices

Awesome plugin, this enhancement may be for another plugin but it would be cool to know your thoughts anyway.

So on mobile the height of each slide is still equal to the height of the viewport however if the content of the slide takes up more space that the slide on mobile it extend out of the element, get hidden or just looks really squished.

I was wondering how can this plugin still be used/improved for mobile, for example maybe making the slides min-height the viewport height instead of giving it a fixed height? Not to sure what else you could do to improve the functionality for mobile devices

Possible Issues with ScrollWheel

Issue noticed by davetica on reddit

"If I scroll more than about 3 clicks on my mousewheel in less time than it takes for the new screen to slide in, the screen just locks and I can't scroll anymore"

Scroll Bar Does Not Track Scroll Position

Bug pointed out by JosephLeo on reddit.

OS: Windows 7
Browser: Google Chrome
Bug:
Scroll to the bottom of the page using the scrollbar.
Scroll down again, this time using the mousewheel.

You will see it scroll "up" to the next "scroll state" instead of the expected "do nothing" action since you're at the bottom of the page already and can't go down any further.

Jittery Scrolling on Mobile

Last commit 909e348, added resize. On mobile browsers with a address bar that hides, this adds jittery scrolling.

Possible - Add isMobile() check to onResize

Typo in Description

On https://paper-leaf.com/alton-jquery-scroll-jacking-plugin/

<body class="pageWrapper">
    <section class="full"&gt
        <div class="slide"></div>
        <div class="slide"></div>
        <div class="slide"></div>
    </section>
</body>

should be like the example on Github

<body class="pageWrapper">
    <section class="full">
        <div class="slide"></div>
        <div class="slide"></div>
        <div class="slide"></div>
    </section>
</body>

Changing useSlideNumbers to false causes error

I have set the useSlideNumbers to false and get the following error in my console:

Uncaught TypeError: Cannot read property '2' of undefined

Which relates to the following lines in the script within the slideindex function within the else brackets (line 250 of the un minified version)

$(slideNumbers[$(element).parent().children().index(element)]).toggleClass('active');

My options are as follows

$(document).alton({
    fullSlideContainer: 'full', // Tell Alton the full height container
    singleSlideClass: 'slide', // Tell Alton the full height slide class
    useSlideNumbers: false, // Set to false if you don't want to use pagination
    slideNumbersBorderColor: '#fff', // Set the outside color of the pagination items
    slideNumbersColor: 'transparent', // Set the inner color of the pagination items
    bodyContainer: 'pageWrapper', // Tell Alton the body class
});

Hero scroll is too sensitive with the trackpad, flicker affect occurs.

There seems to be a little issue when using the track pad on a Macbook pro, OS El Capitan and most likely other computers. When going to the next slide using the trackpad there is a flicker / fast up and down affect for the 'Hero scroll' functionality. It seems it's way too sensitive with the trackpad. Using the scroll on a mouse works fine. This issue is replicated on your 'Hero scroll' example as well but not on the standard or book examples. Other from that it works as intended but unfortunately I can't use it with this issue. Would be great to get a fix. Great plugin though. Thanks.

position:absolute divs displayed on first slide only

Got an issue trying to position a div on second layer so it could be aligned on the bottom side of the slide nevermind the height. Setting a position property to absolute makes a div display on a first slide.
Would you recommend a method to solve this task?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.