Wednesday 23 May 2012

Pretty cool scrolling effect...

http://johnpolacek.github.com/scrollorama/?goback=%2Egde_4285452_member_117858751

How To Use

Disclaimer: This is an experimental, just-for-fun sort of project and hasn’t been thoroughly tested.
Design and build your site, dividing your content into blocks.

★ ★ ★
Embed scrollorama.js after jQuery and initialize the plugin, passing the blocks class selector as a parameter.

$(document).ready(function() {
    var scrollorama = $.scrollorama({
        blocks:'.scrollblock'
    });
});


★ ★ ★
Target an element and animate its properties.

scrollorama.animate('#example1',{
    duration:400, property:'opacity'
})

The animation parameters you can use are:
  • duration number of pixels of scrolling the animation lasts
  • delay number of pixels of scrolling before the animation starts(animation is set to begin when the top of the scroll block is at the bottom of browser window)
  • property css property being animated (must be numeric)
  • start value of the css property at the start of the animation (if unassigned, will be the element’s current property value)
  • end value of the css property at the end of the animation (if unassigned, will be the element’s current property value)
  • pin set to true if you want the scroll block to be pinned during its animations (note: block will be pinned for all its element’s animations)
  • easing 'bounce baby, bounce.' use the same easing equations you're used to. (if unassigned, will be a linear transition)
★ ★ ★
Hook into the onBlockChange event.

scrollorama.onBlockChange(function() {
    alert('You just scrolled to block#'+scrollorama.blockIndex);
});

★ ★ ★
Note: If you are not using the pinning feature, it is recommended you disable it. Pinning requires scroll blocks to be converted to absolute positioning, which can break some layouts.

$(document).ready(function() {
    var scrollorama = $.scrollorama({
        enablePin:false
    });
});

No comments:

Post a Comment