dijit._editor.plugins.AlwaysShowToolbar.globalOnScrollHandler
dojo.require("dijit._editor.plugins.AlwaysShowToolbar");
defined in dijit/_editor/plugins/AlwaysShowToolbar.js
Usage
function () (view source)
var isIE = dojo.isIE && dojo.isIE<7; if(!this._handleScroll){ return; } var tdn = this.editor.toolbar.domNode; var db = dojo.body; if(!this._scrollSetUp){ this._scrollSetUp = true; this._scrollThreshold = dojo._abs(tdn, true).y; // console.log("threshold:", this._scrollThreshold); //what's this for?? comment out for now // if((isIE)&&(db)&&(dojo.style(db, "backgroundIimage")=="none")){ // db.style.backgroundImage = "url(" + dojo.uri.moduleUri("dijit", "templates/blank.gif") + ")"; // db.style.backgroundAttachment = "fixed"; // } } var scrollPos = dojo._docScroll().y; var s = tdn.style; if(scrollPos > this._scrollThreshold && scrollPos < this._scrollThreshold+this._lastHeight){ // dojo.debug(scrollPos); if(!this._fixEnabled){ var tdnbox = dojo.marginBox(tdn); this.editor.iframe.style.marginTop = tdnbox.h+"px"; if(isIE){ s.left = dojo._abs(tdn).x; if(tdn.previousSibling){ this._IEOriginalPos = ['after',tdn.previousSibling]; }else if(tdn.nextSibling){ this._IEOriginalPos = ['before',tdn.nextSibling]; }else{ this._IEOriginalPos = ['last',tdn.parentNode]; } dojo.body().appendChild(tdn); dojo.addClass(tdn,'dijitIEFixedToolbar'); }else{ s.position = "fixed"; s.top = "0px"; } dojo.marginBox(tdn, { w: tdnbox.w }); s.zIndex = 2000; this._fixEnabled = true; } // if we're showing the floating toolbar, make sure that if // we've scrolled past the bottom of the editor that we hide // the toolbar for this instance of the editor. // TODO: when we get multiple editor toolbar support working // correctly, ensure that we check this against the scroll // position of the bottom-most editor instance. var eHeight = (this.height) ? parseInt(this.editor.height) : this.editor._lastHeight; s.display = (scrollPos > this._scrollThreshold+eHeight) ? "none" : ""; }else if(this._fixEnabled){ this.editor.iframe.style.marginTop = ''; s.position = ""; s.top = ""; s.zIndex = ""; s.display = ""; if(isIE){ s.left = ""; dojo.removeClass(tdn,'dijitIEFixedToolbar'); if(this._IEOriginalPos){ dojo.place(tdn, this._IEOriginalPos[1], this._IEOriginalPos[0]); this._IEOriginalPos = null; }else{ dojo.place(tdn, this.editor.iframe, 'before'); } } s.width = ""; this._fixEnabled = false; }