/* * flowup * * based on eric wenn's pullupscroll https://github.com/ericwenn/pullupscroll) * changes include: * - custom namespace for functions * - not dependent on "$" jquery namespace * - works better on items stacked on top of each other in chrome (does not flicker) * - added some custom options including durations and y-displacement * - added ability to control plugin via external css instead appending
* */ var dgpull = dgpull || {}; (function($) {$(document).ready(function() { $(window).scroll(dgpull.scrollfn); }); })(jquery); (function ( $ ) { $.fn.flowup = function(e,options) { var settings = $.extend({ // default translatey: 150, duration: .8, externalcss: false }, options); $(e).addclass('pullup-element'); $(e).each(function(i, el) { var el = $(el); if (el.visible(true)) { el.addclass("already-visible"); } else { el.addclass('opaque'); } }); // �������������֮�� www.lanrenzhijia.com // if external css is not used, add css to head if(!settings.externalcss) { $("head").append(''); } return this; }; // to do: take out of jquery namespace $.fn.visible = function(partial) { var $t = $(this), $w = $(window), viewtop = $w.scrolltop(), viewbottom = viewtop + $w.height(), _top = $t.offset().top, _bottom = _top + $t.height(), comparetop = partial === true ? _bottom : _top, comparebottom = partial === true ? _top : _bottom; return ((comparebottom <= viewbottom) && (comparetop >= viewtop)); }; }( jquery )); dgpull.scrollfn = function() { jquery(".pullup-element").each(function(i, el) { var el = jquery(el); if (el.visible(true)) { el.addclass("come-in"); el.removeclass("opaque"); }}); }