File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ function debounce(fn) {
6
6
7
7
timer = setTimeout ( ( ) => {
8
8
fn . apply ( this , arguments ) ;
9
- } , 100 ) ;
9
+ } , 150 ) ;
10
10
} ;
11
11
} ;
12
12
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ var currentIndex = -1;
4
4
5
5
var font = {
6
6
fontSize : 200 ,
7
- fontFamily : '' ,
8
- fontWeight : ' bold' ,
9
- fontStyle : '' ,
10
- fontVariant : '' ,
7
+ fontFamily : "" ,
8
+ fontWeight : " bold" ,
9
+ fontStyle : "" ,
10
+ fontVariant : "" ,
11
11
}
12
12
13
13
function getTextFontSize ( text ) {
@@ -19,7 +19,7 @@ function updateWord(index) {
19
19
var word = words [ index ] ;
20
20
container . innerHTML = word ;
21
21
// 自适应字体大小
22
- container . style . fontSize = getTextFontSize ( word ) + 'px' ;
22
+ container . style . fontSize = getTextFontSize ( word ) + "px" ;
23
23
}
24
24
25
25
function nextWord ( ) {
@@ -43,7 +43,7 @@ function previousWord() {
43
43
nextWord ( ) ;
44
44
45
45
alert (
46
- ' 点击屏幕右边切换到下一个词,\n点击屏幕左边切换到上一个词,\n目前一共有' + words . length + ' 个词语。'
46
+ " 点击屏幕右边切换到下一个词,\n点击屏幕左边切换到上一个词,\n目前一共有" + words . length + " 个词语。"
47
47
) ;
48
48
49
49
var onClickWithDebounce = debounce ( function onClick ( e ) {
@@ -59,6 +59,12 @@ var onClickWithDebounce = debounce(function onClick(e) {
59
59
// 事件,pc 和 mobile
60
60
window . addEventListener ( "click" , onClickWithDebounce ) ;
61
61
window . addEventListener ( "touchstart" , onClickWithDebounce ) ;
62
+ window . addEventListener ( "gesturestart" , function ( e ) {
63
+ e . preventDefault ( ) ;
64
+ } ) ;
65
+ window . addEventListener ( "dblclick" , function ( e ) {
66
+ e . preventDefault ( ) ;
67
+ } )
62
68
63
69
window . addEventListener ( "keydown" , function ( e ) {
64
70
if ( e . key === "Enter" ) {
You can’t perform that action at this time.
0 commit comments