1// JavaScript Document 2//导èªåºå® 3 var FixedBox=function(el){ 4 this.element=el; 5 this.BoxY=getXY(this.element).y; 6 } 7 FixedBox.prototype={ 8 setCss:function(){ 9 var windowST=(document.compatMode && document.compatMode!="CSS1Compat")? document.body.scrollTop:document.documentElement.scrollTop||window.pageYOffset; 10 if(windowST>this.BoxY){ 11 this.element.style.cssText="position:fixed; top:0; z-index:10; opacity:0.9; "; 12 }else{ 13 this.element.style.cssText=""; 14 } 15 } 16 }; 17 //æ·»å äºä»¶ 18 function addEvent(elm, evType, fn, useCapture) { 19 if (elm.addEventListener) { 20 elm.addEventListener(evType, fn, useCapture); 21 return true; 22 }else if (elm.attachEvent) { 23 var r = elm.attachEvent('on' + evType, fn); 24 return r; 25 } 26 else { 27 elm['on' + evType] = fn; 28 } 29 } 30 //è·åå ç´ çXYåæ ï¼ 31 function getXY(el) { 32 return document.documentElement.getBoundingClientRect && (function() {//åå ç´ åæ ï¼å¦å ç´ æå ¶ä¸å±å ç´ è®¾ç½®position relative 33 var pos = el.getBoundingClientRect(); 34 return { x: pos.left + document.documentElement.scrollLeft, y: pos.top + document.documentElement.scrollTop }; 35 })() || (function() { 36 var _x = 0, _y = 0; 37 do { 38 _x += el.offsetLeft; 39 _y += el.offsetTop; 40 } while (el = el.offsetParent); 41 return { x: _x, y: _y }; 42 })(); 43 } 44 //å®ä¾åï¼ 45 var divA=new FixedBox(document.getElementById("deanheader")); 46 addEvent(window,"scroll",function(){ 47 divA.setCss(); 48 }); 49
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.