function appendHTML(container,html,position){ position =position || 'after'; var objE = document.createElement("div"), nodes=null, fragment = document.createDocumentFragment(); objE.innerHTML = html; nodes=objE.childNodes; for (var i=0, length=n…
// Determine if an element is in the visible viewport function isInViewport(element) { var rect = element.getBoundingClientRect(); var html = document.documentElement; //在IE中,默认坐标从(2,2)开始计算,导致最终距离比其他浏览器多出两个像素,我们需要做个兼容. var top = document.documentElem…
1. 对比cookie // cookie array function getCookieArrayByStr(str) { var cookies = str.split("; "); var cookieObj = {} for (var i=0; i<cookies.length; i++) { var line = cookies[i]; var pos = line.indexOf("="); var key = line.substr(0, po…