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
| /** | |
| * @param {Object} option | |
| * @param {jQuery | String} option.defObj jQuery对象或作为选择器的字符串 | |
| * @param {Number} opiton.defHeight 为负数时,则可以提前加载视口下方的图片资源 | |
| */ | |
| function lazyload(option) { | |
| var settings = { | |
| // {jQuery | String} jQuery对象或作为选择器的字符串 | |
| defObj: null, | |
| // {Number} 为负数时,则可以提前加载视口下方的图片资源 |
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
| // Zepto.js | |
| // (c) 2010-2016 Thomas Fuchs | |
| // Zepto.js may be freely distributed under the MIT license. | |
| // Zepto 用CSS3动画实现动画 | |
| ;(function($, undefined){ | |
| var prefix = '', eventPrefix, | |
| vendors = { Webkit: 'webkit', Moz: '', O: 'o' }, | |
| testEl = document.createElement('div'), | |
| supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i, |
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 fun = function(){ | |
| } | |
| fun.prototype = { | |
| info : { | |
| name : 'peter', | |
| age : 25 | |
| } | |
| } | |
| var a = new fun(); |
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
| /* 清除浮动 */ | |
| .fix{*zoom:1;} | |
| .fix:after{display:table; content:''; clear:both;} | |
| /* 单行文字溢出虚点显示,前提是文本长度大于容器的宽度 */ | |
| /*记忆要点元素溢出、文本溢出、不换行*/ | |
| .ell{text-overflow:ellipsis; white-space: nowrap; overflow: hidden;} | |
| /* 块状元素水平居中 */ | |
| .auto{margin-left:auto; margin-right:auto;} | |
| /* 基于display:table-cell的自适应布局 */ | |
| .cell{display:table-cell; *display:inline-block; width:2000px; *width:auto;} |
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
| @charset "utf-8"; | |
| /* 清除内外边距 */ | |
| body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */ | |
| dl, dt, dd, ul, ol, li, /* list elements 列表元素 */ | |
| pre, /* text formatting elements 文本格式元素 */ | |
| fieldset, legend, button, input, textarea, /* form elements 表单元素 */ | |
| th, td { /* table elements 表格元素 */ | |
| margin: 0; | |
| padding: 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
| function fun(n,o) { | |
| console.log(o) | |
| return { | |
| fun:function(m){ | |
| return fun(m,n); | |
| } | |
| }; | |
| } | |
| var a = fun(0); a.fun(1); a.fun(2); a.fun(3);//undefined,0 ,0 ,0 | |
| var b = fun(0).fun(1).fun(2).fun(3);//undefined,0,1,2 |
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
| // common divisor | |
| function maxComDivisor() { | |
| var args = [].slice.call(arguments); | |
| var len = args.length; | |
| function maxTwoDivi() { | |
| // var args = [].slice.call(arguments); | |
| // console.log(args); | |
| var max = Math.max.apply(Math, arguments); | |
| var min = Math.min.apply(Math, arguments); | |
| if (max % min === 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
| function minComMulti() { | |
| var args = [].slice.call(arguments); | |
| var len = args.length; | |
| if (len < 1) return; | |
| if (len === 1) return args[0]; | |
| if (len === 2) { | |
| // minTwoMulti(); | |
| var max = Math.max.apply(Math, args); | |
| var min = Math.min.apply(Math, args); | |
| for (var i = 1;; i++) { |
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
| // 1. | |
| function unShowPopup() { | |
| $(document).on('click', function(ev) { | |
| var $target = $(ev.target); | |
| // 当查找到顶部时还找不到指定的类名,则循环结束 | |
| while ($target.length > 0) { | |
| // 当找到了指定类名时,则跳出函数,即不隐藏拥有该类名的元素 | |
| if ($target.hasClass('dataform')) { | |
| console.log(1); | |
| return; |