This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findPos(obj) { | |
| var curleft = curtop = 0, scr = obj, fixed = false; | |
| while ((scr = scr.parentNode) && scr != document.body) { | |
| curleft -= scr.scrollLeft || 0; | |
| curtop -= scr.scrollTop || 0; | |
| if (getStyle(scr, "position") == "fixed") fixed = true; | |
| } | |
| if (fixed && !window.opera) { | |
| var scrDist = scrollDist(); | |
| curleft += scrDist[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| top:expression(documentElement.scrollTop + documentElement.clientHeight - this.clientHeight-85 + 'px') | |
| http://t.163.com/ | |
| position: absolute; top: expression(((document.documentElement.scrollTop || document.body.scrollTop) + (document.documentElement.clientHeight || document.body.clientHeight) - this.offsetHeight) + "px"); | |
| http://www.seabreezecomputers.com/tips/fixed-div.htm | |
| _top: expression(eval(document.compatMode && document.compatMode=='CSS1Compat') | |
| ? documentElement.scrollTop +(documentElement.clientHeight-this.clientHeight) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(util) { | |
| var toString = Object.prototype.toString; | |
| var AP = Array.prototype; | |
| util.isString = function(val) { | |
| return toString.call(val) === '[object String]'; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Function to get the amount of pixels scrolled | |
| // Copied from the Internet | |
| function getScrollXY() { | |
| var scrOfX = 0, scrOfY = 0; | |
| if( typeof( window.pageYOffset ) == 'number' ) { | |
| //Netscape compliant | |
| scrOfY = window.pageYOffset; | |
| scrOfX = window.pageXOffset; | |
| } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { | |
| //DOM compliant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function queue(name){ | |
| queue.q[name]++ || (queue.q[name] = 1); | |
| return function(err){ | |
| if (err && queue.e[name]) queue.e[name](err); | |
| else if (err) throw err; | |
| process.nextTick(function(){ | |
| queue.q[name]--; | |
| queue.check(name); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isnan = /^(NaN|-?Infinity)$/; | |
| function isNumeric(num) { | |
| return !isnan.test(+num); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function is(o, type) { | |
| type = String(type).toLowerCase(); | |
| return (type == "null" && o === null) || | |
| (type == typeof o) || | |
| (type == "object" && o === Object(o)) || | |
| (type == "array" && Array.isArray && Array.isArray(o)) || | |
| Object.prototype.toString.call(o).slice(8, -1).toLowerCase() == type; | |
| } | |
| is(function(){}, "object"); // true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var addEvent=(function(){ | |
| if(document.addEventListener){ | |
| return function(el,type,fn){ | |
| if(el.length){ | |
| for(var i=0;i<el.length;i++){ | |
| addEvent(el[i],type,fn); | |
| } | |
| }else{ | |
| el.addEventListener(type,fn,false); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function addEvent(elm, evType, fn, useCapture) { | |
| if (elm.addEventListener) { | |
| elm.addEventListener(evType, fn, useCapture);//DOM2.0 | |
| return true; | |
| } | |
| else if (elm.attachEvent) { | |
| var r = elm.attachEvent('on' + evType, fn);//IE5+ | |
| return r; | |
| } | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Example call of the function: | |
| getStyle(document.getElementById("container"), "font-size"); | |
| */ | |
| // The regular version | |
| function getStyle(oElm, strCssRule){ | |
| var strValue = ""; | |
| if(document.defaultView && document.defaultView.getComputedStyle){ |