Skip to content

Commit 48ccdb2

Browse files
committed
chore: prevent scale
1 parent fe9bbc8 commit 48ccdb2

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function debounce(fn) {
66

77
timer = setTimeout(() => {
88
fn.apply(this, arguments);
9-
}, 100);
9+
}, 150);
1010
};
1111
};
1212

init.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ var currentIndex = -1;
44

55
var font = {
66
fontSize: 200,
7-
fontFamily: '',
8-
fontWeight: 'bold',
9-
fontStyle: '',
10-
fontVariant: '',
7+
fontFamily: "",
8+
fontWeight: "bold",
9+
fontStyle: "",
10+
fontVariant: "",
1111
}
1212

1313
function getTextFontSize(text) {
@@ -19,7 +19,7 @@ function updateWord(index) {
1919
var word = words[index];
2020
container.innerHTML = word;
2121
// 自适应字体大小
22-
container.style.fontSize = getTextFontSize(word) + 'px';
22+
container.style.fontSize = getTextFontSize(word) + "px";
2323
}
2424

2525
function nextWord() {
@@ -43,7 +43,7 @@ function previousWord() {
4343
nextWord();
4444

4545
alert(
46-
'点击屏幕右边切换到下一个词,\n点击屏幕左边切换到上一个词,\n目前一共有' + words.length + '个词语。'
46+
"点击屏幕右边切换到下一个词,\n点击屏幕左边切换到上一个词,\n目前一共有" + words.length + "个词语。"
4747
);
4848

4949
var onClickWithDebounce = debounce(function onClick(e) {
@@ -59,6 +59,12 @@ var onClickWithDebounce = debounce(function onClick(e) {
5959
// 事件,pc 和 mobile
6060
window.addEventListener("click", onClickWithDebounce);
6161
window.addEventListener("touchstart", onClickWithDebounce);
62+
window.addEventListener("gesturestart", function (e) {
63+
e.preventDefault();
64+
});
65+
window.addEventListener("dblclick", function (e) {
66+
e.preventDefault();
67+
})
6268

6369
window.addEventListener("keydown", function(e) {
6470
if (e.key === "Enter") {

0 commit comments

Comments
 (0)