Results 44 issues of panshao

先来一张效果图 ![](https://jackpanyj.github.io/blog_demo/img/ant.png) 图是静态的,真正的效果应该是动态的。 先上代码: `html` 部分: ``` html 蚂蚁行军 ``` `css` 部分: ``` css body { display: flex; justify-content: center; align-items: center; height: 100vh; } .ant { display: flex; justify-content:...

在MDN上找到了一个封装好的cookie的库, 简洁优雅。 ``` js /*\ |*| :: cookies.js :: |*| A complete cookies reader/writer framework with full unicode support. |*| This framework is released under the GNU Public License, version...

前端浏览器,各种各样。主要有ie, chrome, firefox等。 有些时候不得不对个别的浏览器进行单独检测,然后分别对不同的浏览器写出不同的代码。 所以把浏览器检测封装成了一个模块。 代码如下: ``` js browser.js // 浏览器判断 const CHROME = 'chrome' const FIREFOX = 'firefox' const SAFARI = 'safari' const OPERA = 'opera' const IE =...

最近这个单词一直出现在我的视野中,慢慢的也对它有了一定的了解。 按照我的理解,这个`polyfill`可以理解为补丁的意思。大部分都是为 浏览器不支持 某些特性而打的补丁。 比如有一个数组方法Array.prototype.includes 的方法。它在某些浏览器下是不支持的,所以就会有一个 `polyfill`, 如下 ``` js if (!Array.prototype.includes) { Array.prototype.includes = function(searchElement /*, fromIndex*/ ) { 'use strict'; var O = Object(this); var len = parseInt(O.length)...