Wing Meng

Results 75 comments of Wing Meng

参照了 @XboxYan 的一些思路,控制台输出验证结果的思路很棒!:clap: 基本实现了题目要求,跑通了相关测试用例,相关细节还是有待打磨。另外,没能实现对于英文省略号的特殊处理(和使用全角中文标点相冲突)。 ---- ```js var testSpecs = [ '在LeanCloud上,数据存储是围绕AVObject进行的。', '今天出去买菜花了 5000元。', '我家的光纤入户宽带有 10Gbps,SSD 一共有 10TB。显示器分辨率宽度是1920px。', '今天是 233 ° 的高温。新 MacBook Pro 有 15 % 的 CPU 性能提升。', '刚刚买了一部...

第 1 题和第 2 题,**两大问题,一个对策**。已封装成组件,只需为构造函数传入需要“返回顶部”功能的容器元素即可,默认为 body 元素。 #### [在线演示](https://runjs.cn/code/ltitwfef) ```css .back-top { position: fixed; margin-top: -15px; margin-left: -15px; transform: translate(-100%, -100%); white-space: nowrap; } ``` ```js /** * 返回顶部 *...

```js var selectElm = document.querySelector('select'); ``` #### 第 1 题 ```js selectElm.form ``` #### 第 2 题 ```js selectElm.selectedIndex // 或者 selectElm.options.selectedIndex ``` #### 第 3 题 ```js selectElm.options[2].value ```...

[> 在线 Demo .tag {position: absolute;} .book-item > img { display: block; width: 120px; height: 160px; } .tag { display: inline-block; padding: 3px 5px; box-sizing: border-box; line-height: 1.2; font-size: 12px;...

[> DEMO 感觉自己第3题实现的不够优雅…… ```js /*** 第 1 题 ***/ var box = document.createElement('div'); box.style.width = '150px'; box.style.height = '300px'; document.body.appendChild(box); /*** 第 2 题 ***/ // 方法1:使用位置关键词 box.style.background = 'linear-gradient(to...

感谢张老师的精彩分享 @zhangxinxu ,同时对 @XboxYan 清奇的思路表示佩服,受大神的启发,封装了个通用方法来作为第 3 题的补充: ```js /** * 颜色过渡效果构造器 * @descr: color1 渐变过渡到 color2,color2 渐变过渡到 color1 * @param {string} color1 - 颜色1,可以是:颜色关键字/HSL(A)/RGB(A)/HEX * @param {string} color2 - 颜色2,同上...

```css [hidden] {display: none;} .overlay { padding: 1em; background: #fff; border: 1px solid #ccc; } ``` ```html 显示浮层1 显示浮层2 我是 浮层1 我是 浮层2 ``` ```js class Overlay { constructor(id) {...

1. #### 需要 JS 加持的方案  [> 在线 Demo img { display: block; width: 100%; max-width: 120px; margin: auto; } ``` ```html 甜甜圈 其他内容其他内容其他内容其他内容其他内容其他内容其他内容其他内容 ``` ```js const navEl = document.getElementById('nav'); //...

#### 第 1 题: ```js let a_labels = document.querySelectorAll('a'); ``` #### 第 2 题: ```js let links = document.querySelectorAll(':link'); ``` #### 第 3 题: > 使用 `querySelectorAll` 获取的元素可直接用 `forEach` 遍历,或者转换为...

```css /* 方法1(IE8+) */ .quiz { display: table; } .quiz-h { padding: 0 10px; margin: 0; vertical-align: middle; } .quiz-p { margin: 0 5px; } /* 方法2(IE10+) */ .quiz {...