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
| /* | |
| @ 名称: position:fixed | |
| @ 用法:添加class | |
| @ 注意: | |
| * 如果需要多个方向的固定位置,比如 top + right,需要加两个 class | |
| * 如果加了.fixed-top, 那么就别给这个元素加 top 属性的值 | |
| * 为了不出现异常,这个只作为套用。比如要top:30px 的时候,请在 .fixed-top 的子元素内设置 | |
| * 由于我们有打包,所以,改solution是可以滴,但这是强烈不推荐的,因为不利于维护 | |
| */ |
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
| // 行注释不会被生成到最后的css中。 块注释则会生成到样式文件中 | |
| // 代码顺序: 布局(定位)>盒模型(宽高,margin,padding,border)>背景、颜色、字体等 | |
| // 尽量不同时给一个盒子设置 width 和 margin-left、margin-right、padding-left、padding-right | |
| // height 同理。 |
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
| /* | |
| * IE support html5 tag | |
| */ | |
| header, nav, section, footer, aside { | |
| display: block; | |
| } |
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
| /** | |
| * animate | |
| */ | |
| (function (d) { | |
| // 判断是否有重名函数 | |
| if (d.animate) { | |
| throw new Error('methods already exist'); | |
| } |
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 () { | |
| Element.prototype.myGetElementsByClassName = function (name) { | |
| var result = [], | |
| element = this, | |
| childrens = element.children, | |
| lenth = element.childElementCount; | |
| for (var i = 0; i < lenth; i++) { | |
| console.log(childrens[i].className); | |
| if (childrens[i].className.indexOf(name) !== -1) { |
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
| <!DOCTYPE HTML> | |
| <html lang="en-US"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>man</title> | |
| </head> | |
| <body> | |
| <p>打开console查看运行结果~</p> | |
| <script type="text/javascript"> | |
| var Man; |
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 each = function(obj, fn){ | |
| //+++++++++++答题区域+++++++++++ | |
| var isArray = (Array.isArray) ? Array.isArray(obj) : typeof obj === "object" && Object.prototype.toString.call(obj) === "[object Array]"; | |
| for (prop in obj) { | |
| var value = obj[prop]; | |
| if (isArray) { | |
| if (fn.call( value, +prop + 1) === false) return; | |
| } else { | |
| if (fn.call(value, value, prop) === false) return; |
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 getSecondToZero() { | |
| var today = new Date(), | |
| hour = today.getHours(), | |
| minutes = today.getMinutes(), | |
| seconds = today.getSeconds(), | |
| zero_hour = 24, | |
| zero_minu = 0, | |
| zero_seconds = 0; | |
| if (seconds != 0) { | |
| zero_seconds = 60; |
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 walkTheDom(root, callback) { | |
| var childrens = root.children, | |
| count = childrens.length; | |
| callback(root); | |
| if (count === 0) { | |
| return; | |
| } else { |