Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheney committed Sep 2, 2020
1 parent 5815e9c commit bf75a7d
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion _posts/2020-08-24-arts3.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,41 @@ keywords: ARTS, 前端, leetCode
}
```

> 参考:[3 种方法实现 CSS 隐藏滚动条并可以滚动内容](http://caibaojian.com/hide-scrollbar.html){:target='\_blank'}
> 参考:[3 种方法实现 CSS 隐藏滚动条并可以滚动内容](http://caibaojian.com/hide-scrollbar.html){:target='\_blank'}
- [js手动触发窗口resize事件](https://www.jianshu.com/p/ded9183ed8db){:target='_blank'}
```js
function doResize(){
setTimeout(function(){
//手动触发窗口resize事件
if(document.createEvent) {
var event = document.createEvent("HTMLEvents");
event.initEvent("resize", true, true);
window.dispatchEvent(event);
} else if(document.createEventObject) {
window.fireEvent("onresize");
}
},100);
}
```

```js
// MDN
// 创建事件
var event = document.createEvent('Event');
// 定义事件名为'build'.
event.initEvent('build', true, true);
// 监听事件
elem.addEventListener('build', function (e) {
// e.target matches elem
}, false);
// 触发对象可以是任何元素或其他事件目标
elem.dispatchEvent(event);
```
> 参考:[MDN Document.createEvent()](https://developer.mozilla.org/zh-CN/docs/Web/API/Document/createEvent){:target='_blank'}

- Share

Expand Down

0 comments on commit bf75a7d

Please sign in to comment.