Skip to content

Commit

Permalink
Update jquery.scrollme.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nckprsn committed Jun 22, 2014
1 parent 561d99f commit 67dc2d8
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions jquery.scrollme.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,20 @@
var effect = {};

effect.element = $( this );

effect.when = effect.element.data( 'when' );
effect.from = effect.element.data( 'from' );
effect.to = effect.element.data( 'to' );

if( effect.element.is( '[data-crop]' ) )
{
effect.crop = effect.element.data( 'crop' );
}
else
{
effect.crop = true;
}

if( effect.element.is( '[data-easing]' ) )
{
effect.easing = easing_functions[ effect.element.data( 'easing' ) ]
Expand Down Expand Up @@ -208,7 +218,8 @@

switch( effect.when )
{
case 'view' :
case 'view' : // Maintained for backwards compatibility
case 'span' :
var start = element.top - viewport_height;
var end = element.bottom;
break;
Expand All @@ -224,8 +235,13 @@
break;
}

if( start < 0 ) start = 0;
if( end > ( body_height - viewport_height ) ) end = body_height - viewport_height;
// Crop boundaries

if( effect.crop )
{
if( start < 0 ) start = 0;
if( end > ( body_height - viewport_height ) ) end = body_height - viewport_height;
}

// Get scroll position of reference selector

Expand Down

0 comments on commit 67dc2d8

Please sign in to comment.