var Sticky = (function(){ function StickyClass(config) { this.placeholder = config.placeholder; this.elementList = config.childList || []; this.container = config.fixedContainer; this.class = config.class || { sticky : 'sticky', nonSticky : 'non-sticky' }; //sticky nonsticky this.elementAdded = false; //this.animate = config.animate; this.init = function() { this.addElementInFixedContainer(); return this; } this.footer = config.footer || $('#footer'); $(window).scroll(function(){ if(!this.ui){ this.ui = require('ui'); } var containerRects = this.placeholder.getClientRects().item(0); if(containerRects.bottom < 0 && (!this.ui.inView(this.footer,true))) { this.setStickyNonSticky(true); } else if(containerRects.bottom > 0 || this.ui.inView(this.footer,true)){ this.setStickyNonSticky(false); } }.bind(this)); } StickyClass.prototype.addElementInFixedContainer = function(){ if(this.elementAdded)return for(var i=0; i