huyueshan

导航

2019年12月12日 #

页面滚动到指定元素区域

摘要: 该代码段可将指定元素平滑滚动到浏览器窗口的可见区域。 const smoothScroll = element => document.querySelector(element).scrollIntoView({ behavior: 'smooth' }); smoothScroll('#fooB 阅读全文

posted @ 2019-12-12 22:50 huyueshan 阅读(766) 评论(0) 推荐(0) 编辑

2019年5月11日 #

js简洁模式代码

摘要: 1 // 创建过去七天的数组,如果将代码中的减号换成加号,你将得到未来7天的数组集合 2 [...Array(7).keys()].map(days => new Date(Date.now() - 86400000 * days)); 3 4 // 生成长度为11的随机字母数字字符串 5 Math.random().toString(36).substring(2); 6 7... 阅读全文

posted @ 2019-05-11 22:09 huyueshan 阅读(313) 评论(0) 推荐(0) 编辑

2019年3月24日 #

简单git使用命令

摘要: // 查看分支:git branch // 创建分支:git branch <name> // 切换分支:git checkout <name> // 创建+切换分支:git checkout -b <name> // 合并某分支到当前分支:git merge <name> // 删除分支:git 阅读全文

posted @ 2019-03-24 22:02 huyueshan 阅读(122) 评论(0) 推荐(0) 编辑

2019年3月10日 #

图片懒加载 echo.js

摘要: 如何使用 1、引入文件 <script src="js/echo.min.js"></script> 2、HTML结构 <img src="img/blank.gif" alt="Photo" data-echo="img/photo.jpg" /> blank.gif 是一个 1 x 1 的图片, 阅读全文

posted @ 2019-03-10 19:55 huyueshan 阅读(432) 评论(0) 推荐(0) 编辑

页面图片预加载与懒加载

摘要: 预加载 方法一:CSS实现预加载 1 #preload-01 { background: url(http://domain.tld/image-01.png) no-repeat -9999px -9999px; } 2 #preload-02 { background: url(http://d 阅读全文

posted @ 2019-03-10 12:47 huyueshan 阅读(1014) 评论(0) 推荐(0) 编辑

2019年3月4日 #

js 实现操作浏览器或者元素的全屏与退出全屏功能

摘要: 1 2 3 4 5 6 7 8 Document 9 10 11 12 13 新窗口 14 全屏 15 退出全屏 16 17 18 19 78 79 阅读全文

posted @ 2019-03-04 10:40 huyueshan 阅读(369) 评论(0) 推荐(0) 编辑

js 实现拖拽排序

摘要: 1 2 3 4 5 6 拖拽排序 7 18 19 20 --> 21 --> 22 23 24 25 26 1 27 2 28 3 29 4 30 5 31 6 32 ... 阅读全文

posted @ 2019-03-04 10:29 huyueshan 阅读(7276) 评论(0) 推荐(0) 编辑

2019年3月1日 #

js获取世界不同时区的当前时间

摘要: 1 2 3 4 5 设置显示不同时区时间 6 7 8 9 10 11 12 13 14 51 52 阅读全文

posted @ 2019-03-01 09:54 huyueshan 阅读(10499) 评论(0) 推荐(1) 编辑

html2canvas将页面内容生成图片

摘要: html2canvas官网链接地址:https://html2canvas.hertzen.com/ 阅读全文

posted @ 2019-03-01 09:31 huyueshan 阅读(798) 评论(0) 推荐(0) 编辑

canvas绘制环形进度条

摘要: 1 2 3 4 5 6 7 8 环形进度条 9 10 11 12 13 14 15 抱歉,您的浏览器不支持canvas 16 17 18 19 141 142 阅读全文

posted @ 2019-03-01 09:19 huyueshan 阅读(1027) 评论(0) 推荐(0) 编辑