Skip to content

Update some files 单击 => 点击 #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2-ui/1-document/02-dom-nodes/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ drawHtmlTree(node1, 'div.domtree', 690, 320);
</script>

```online
在上面的图片中,你可以单击元素(element)节点,它们的子节点会打开/折叠。
在上面的图片中,你可以点击元素(element)节点,它们的子节点会打开/折叠。
```

每个树的节点都是一个对象。
Expand Down
4 changes: 2 additions & 2 deletions 2-ui/1-document/09-size-and-scroll/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ element.style.height = `${element.scrollHeight}px`;
```

```online
单击按钮展开元素
点击按钮展开元素

<div id="element" style="width:300px;height:200px; padding: 0;overflow: auto; border:1px solid black;">text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text</div>

Expand All @@ -206,7 +206,7 @@ element.style.height = `${element.scrollHeight}px`;
大多数几何属性是只读的,但是 `scrollLeft/scrollTop` 是可修改的,并且浏览器会滚动该元素。

```online
如果你单击下面的元素,则会执行代码 `elem.scrollTop += 10`。这使得元素内容向下滚动 `10px`。
如果你点击下面的元素,则会执行代码 `elem.scrollTop += 10`。这使得元素内容向下滚动 `10px`。

<div onclick="this.scrollTop+=10" style="cursor:pointer;border:1px solid black;width:100px;height:80px;overflow:auto">Click<br>Me<br>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9</div>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

<body>

单击任意位置来获取窗口坐标
点击任意位置来获取窗口坐标
<br> 这仅用于测试,用来检查你通过 JavaScript 获得的结果。
<br>
<div id="coords">(单击坐标显示在这里)</div>
<div id="coords">(点击坐标显示在这里)</div>


<div id="field">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

<body>

单击任意位置来获取窗口坐标
点击任意位置来获取窗口坐标
<br> 这仅用于测试,用来检查你通过 JavaScript 获得的结果。
<br>
<div id="coords">(单击坐标显示在这里)</div>
<div id="coords">(点击坐标显示在这里)</div>


<div id="field">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ importance: 5
3. 左上的内角(这有点难)。
4. 右下的内角(有几种方式,选择其中一种)。

你计算得到的坐标,应该与单击鼠标返回的坐标相同
你计算得到的坐标,应该与点击鼠标返回的坐标相同

P.S. 如果元素具有其他大小(size)和边框(border),且未绑定任何固定的值,你写的代码也应该起作用。
2 changes: 1 addition & 1 deletion 2-ui/1-document/11-coordinates/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- `left/right` — 左/右矩形边缘的 X 坐标。

```online
例如,单击下面这个按钮以查看其窗口坐标
例如,点击下面这个按钮以查看其窗口坐标

<p><input id="brTest" type="button" value="Get coordinates using button.getBoundingClientRect() for this button" onclick='showRect(this)'/></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ importance: 5

# 隐藏自己

创建一个按钮,在被单击时,隐藏自己。
创建一个按钮,在被点击时,隐藏自己。

```online
就像这样:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

![](move-ball-coords.svg)

我们有 `event.clientX/clientY` —— 单击位置的窗口相对坐标
我们有 `event.clientX/clientY` —— 点击位置的窗口相对坐标

要获取单击位置的球场相对坐标 `left`,我们可以减去球场左边缘和边框的宽度:
要获取点击位置的球场相对坐标 `left`,我们可以减去球场左边缘和边框的宽度:

```js
let left = event.clientX - fieldCoords.left - field.clientLeft;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ importance: 5

# 让球在球场中移动

单击球场中任意一点,让球在球场中移动。就像这样:
点击球场中任意一点,让球在球场中移动。就像这样:

[iframe src="solution" height="260" link]

要求:

- 球的中心应该恰好在单击时指针位置的下方(如果在球不越过球场边缘的情况下,能实现的话)。
- 球的中心应该恰好在点击时指针位置的下方(如果在球不越过球场边缘的情况下,能实现的话)。
- 最好添加一些 CSS 动画。
- 球不能越过场地边界。
- 页面滚动时,不会有任何中断。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ importance: 5

# 创建滑动菜单

创建一个在单击时打开/折叠的菜单:
创建一个在点击时打开/折叠的菜单:

[iframe border=1 height=100 src="solution"]

Expand Down
6 changes: 3 additions & 3 deletions 2-ui/2-events/01-introduction-browser-events/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
<input value="Click me" *!*onclick="alert('Click!')"*/!* type="button">
```

在鼠标单击时,`onclick` 中的代码就会运行。
在鼠标点击时,`onclick` 中的代码就会运行。

请注意,在 `onclick` 中,我们使用单引号,因为特性本身使用的是双引号。如果我们忘记了代码是在特性中的,而使用了双引号,像这样:`onclick="alert("Click!")"`,那么它就无法正确运行。

HTML 特性不是编写大量代码的好位置,因此我们最好创建一个 JavaScript 函数,然后在 HTML 特性中调用这个函数。

在这里单击会运行 `countRabbits()`:
在这里点击会运行 `countRabbits()`:

```html autorun height=50
<script>
Expand Down Expand Up @@ -188,7 +188,7 @@ button.onclick = function() {
这样的调用会失效:

```js run no-beautify
// 单击 <body> 将产生 error,
// 点击 <body> 将产生 error,
// 因为特性总是字符串的,函数变成了一个字符串
document.body.setAttribute('onclick', function() { alert(1) });
```
Expand Down