摘要: var CookieUtil = { get: function (name) { var cookieName = encodeURIComponent(name) + "=", cookieStart = document.cookie.indexOf(cookieName), cookieValue = null; if (cookieStart... 阅读全文
posted @ 2019-09-25 19:49 寒筱洱 阅读(334) 评论(0) 推荐(0) 编辑
摘要: function throttle(method, context) { clearTimeout(method.tId); method.tId = setTimeout(function () { method.call(context); }, 100); } function resizeDiv() { var div = document.getElementB... 阅读全文
posted @ 2019-09-25 19:38 寒筱洱 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 对于每次判断条件都相同的多次调用函数,例如检测浏览器是否支持某方法,可以通过惰性载入函数减少if判断次数,提高性能。 阅读全文
posted @ 2019-09-25 19:18 寒筱洱 阅读(198) 评论(0) 推荐(0) 编辑