XueFeng

Results 48 comments of XueFeng

```js /** * 抢红包算法 * @param {*} money 红包金额数 * @param {*} people 红包人数 */ function drawLucky (money, people) { let remainMoney = money let remainPeople = people return {...

用`grid`实现了一个超简版的,暂时没考虑图片拉伸; [demo](https://codepen.io/xxf1996/pen/OJPomyP) ```css .demo { display: grid; grid-template: repeat(2, 1fr)/repeat(3, 1fr); gap: 10px; height: 400px; } .pic { width: 100%; height: 100%; } .pic:nth-of-type(1) { grid-row: 1/3; grid-column: 1/2; }...

[demo](https://codepen.io/xxf1996/pen/MWWxENz) ```css li.selected { color: red; } ``` ```html 列表1 列表2 列表3 ``` ```js let list = document.getElementById('list') let items = list.querySelectorAll('li') let inputItem = document.getElementById('input') let cur = -1...

```js let time = null // 定时器句柄 function check520 () { const cur = new Date() const year = cur.getFullYear() let target = new Date(`${year}/5/20 13:14`) if (cur.getTime() > target.getTime())...

```js /** * 屏蔽句子中的某些词 * @param {string} sentence 待审核句子 * @param {string} word 屏蔽词 */ function filterWord (sentence, word) { const star = new Array(word.length).fill('*').join('') const reg = new RegExp(`((?

```css th { word-break: keep-all; } ```

移动端可以使用touchEvent来处理拖拽操作; [demo](https://codepen.io/xxf1996/full/WNQVKOj) ```html A B ``` ```css body { max-width: 400px; } #t1 { width: 100px; height: 100px; background-color: lightcoral; } #t2 { min-height: 200px; margin-top: 30px; background-color: lightcyan; }...

[demo](https://codepen.io/xxf1996/pen/abbGVZg) 关于无障碍访问这块真是了解的太少了,需要好好补一补; `clip-path`在IE上面的兼容性有点惨不忍睹…… ```html 1-规则说明 2-参与活动 3-参与抽奖 4-奖品发放 5-查看结果 ``` ```css .item { position: relative; display: inline-block; height: 40px; padding: 0 1em 0 24px; margin-right: 3px; line-height: 40px; color: #8c8c8c;...

[在线demo](https://codepen.io/xxf1996/full/oKgbGJ) html: ```html Unicode 只是规定了 Emoji 的码点和含义,并没有规定它的样式。举例来说,码点U+1F600表示一张微笑的脸,但是这张脸长什么样,则由各个系统自己实现。 IT 连载中 1123.4万字 Emoji 虽然是文字,但是无法书写,必须使用其他方法插入文档。 emoji 已完结 12.4万字 Unicode 只是规定了 Emoji 的码点和含义,并没有规定它的样式。举例来说,码点U+1F600表示一张微笑的脸,但是这张脸长什么样,则由各个系统自己实现。 IT 连载中 1123.4万字 Emoji 虽然是文字,但是无法书写,必须使用其他方法插入文档。 emoji 已完结 12.4万字 ``` css: ```css...