/** * Created by chenyihong on 14/12/4. */KindEditor.plugin('fixtoolbar',function(K){varself=this;if(!self.fixToolBar){return;}functioninit(){vartoolbar=K('.ke-toolbar');varoriginY=toolbar.pos().y;K(window).bind('scroll',function(){if(toolbar.css('position')=='fixed'){if(document.body.scrollTop-originY<0){toolbar.css('position','static');toolbar.css('top','auto');}}else{if(toolbar.pos().y-document.body.scrollTop<0){toolbar.css('position','fixed');toolbar.css('top',0);}}});}if(self.isCreated){init();}else{self.afterCreate(init);}});