Skip to content

Commit

Permalink
JS增加动画函数封装
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcaffebabe committed Jan 28, 2020
1 parent 1b7c698 commit 78a1dd9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 前端开发/JavaScript/JavaScript.md
Expand Up @@ -182,6 +182,19 @@ reg.test('some text');

- 返回新的Window对象

# 动画函数封装

>核心原理:通过定时器 setInterval() 不断移动盒子位置。
- 利用 JS 是一门动态语言,可以很方便的给当前对象添加属性来将定时器添加到对象中

```js
obj.timer = setInterval(function() {
//..
clearInterval(obj.timer);
})
```

# JSON

## 语法
Expand Down
4 changes: 4 additions & 0 deletions 前端开发/JavaScript/事件.md
Expand Up @@ -123,3 +123,7 @@ onkeypress | 某个键盘按键被按下时触发,但是不识别功能键

- keyCode:返回该键的ASCII值

### mouseenter 和mouseover的区别

当鼠标移动到元素上时就会触发mouseenter 事件,- mouseover 鼠标经过自身盒子会触发,经过子盒子还会触发。mouseenter  只会经过自身盒子触发,之所以这样,就是因为mouseenter不会冒泡,跟mouseenter搭配鼠标离开 mouseleave  同样不会冒泡

0 comments on commit 78a1dd9

Please sign in to comment.