Created
May 7, 2014 07:56
-
-
Save pesblog/295eca7ba243f165cb37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(someMyOneDiv).on('inview', function(e, isInView, visiblePartX, visiblePartY) { | |
var elem = $(this); | |
if (elem.data('inviewscroller')) { | |
elem.off('scroll.inview'); | |
elem.removeData('inviewscroller'); | |
} | |
if (isInView) { | |
elem.data('inviewscroller', true); | |
elem.on('scroll.inview', $.throttle(200, function() { | |
if (visiblePartY == 'top') { | |
elem.data('seenTop', true); | |
} else if (visiblePartY == 'bottom') { | |
elem.data('seenBottom', true); | |
} else { | |
elem.data('seenTop', true); | |
elem.data('seenBottom', true); | |
} | |
if (elem.data('seenTop') && elem.data('seenBottom')) { | |
elem.unbind('inview'); | |
// elem.off('scroll.inview'); これは要らないかな? | |
//ここに処理を書く | |
} | |
})); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment