From 989f29e6b2097cdba407e291690c46a50b001db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Wed, 23 Nov 2022 14:31:08 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 翁章彬 <2629351295@qq.com> --- .../2022-11-23 \344\275\234\344\270\232.md" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-23 \344\275\234\344\270\232.md" diff --git "a/01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-23 \344\275\234\344\270\232.md" "b/01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-23 \344\275\234\344\270\232.md" new file mode 100644 index 0000000..48a4393 --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-23 \344\275\234\344\270\232.md" @@ -0,0 +1,40 @@ +```html + +``` + +字符串长度 + +```html + +``` + -- Gitee From b30ce921913197b47ee7e3317599c1055d2b7f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Wed, 23 Nov 2022 14:31:23 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 翁章彬 <2629351295@qq.com> --- .../2022-11-23 \347\254\224\350\256\260.md" | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-23 \347\254\224\350\256\260.md" diff --git "a/01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-23 \347\254\224\350\256\260.md" "b/01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-23 \347\254\224\350\256\260.md" new file mode 100644 index 0000000..529f572 --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-23 \347\254\224\350\256\260.md" @@ -0,0 +1,39 @@ +# jQuery事件 + +在文档加载后激活函数(常用写法) + +``` +$(function(){ + $('#txt').keyup( + function () { + $('#num').text($('#txt').val().length); + } + ) +}); +``` + +### 常用事件 + +**click()**:鼠标单击 + +**contextmenu()**:右键单击菜单(右键菜单按钮时间,可以拒绝右键菜单。) + +**dblclick()**:双击触发 + +**mousedown()**:鼠标按下 + +**mouseup()**:鼠标松开 + +**mousemove()**:鼠标移动 + +**mouseout()**:鼠标移出元素 + +**mouseover()**:鼠标移入元素 + +**keydown()**:按下键盘 + +**keyup()**:按下键盘松开 + +**focus()**:获得焦点 + +**blur()**:失去焦点 -- Gitee From b52cafffebb203c057f4df1b178b501a7874f348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Sun, 27 Nov 2022 13:15:53 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 翁章彬 <2629351295@qq.com> --- .../2022-11-24 \347\254\224\350\256\260.md" | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-24 \347\254\224\350\256\260.md" diff --git "a/01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-24 \347\254\224\350\256\260.md" "b/01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-24 \347\254\224\350\256\260.md" new file mode 100644 index 0000000..3f4f5ce --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/\347\254\224\350\256\260/2022-11-24 \347\254\224\350\256\260.md" @@ -0,0 +1,73 @@ +## jQuery + +### 绑定 + +#### 多个事件绑定一个函数 + +```html +bind('事件类型',函数) +``` + +#### 多个事件绑定多个函数(键值对) + +```html +bind({'事件类型': 函数,'事件类型':函数}) +``` + +#### on绑定(动态元素绑定) + +```html +//$(父代选择器) +var text = $(''); +$(function () { + $('td').mousedown(function () { + $(this).append(text); + }) + }) +$(function () { + $('td').on('blur','#text',function () { + text.parent().text(text.val()); + }); + }) +``` + +### 解绑 + +```html +$(function () { + $('td').mousedown(function () { + $(this).append(text); + }).off() + //不带参移除所有事件 + }) +//带参移除特定事件 +``` + +### 一次事件(类似立即执行函数) + +```html +$(function () { + $('td').one(function () { + //当前元素只触发一次该事件 + $(this).append(text); + }) + }) +``` + + + +## hover(鼠标移入移出) + +```html +$(function () { + $('div').hover( + function () { + $(this).css('color','red') + }, + function () { + $(this).css('color','white') + } + ) + }) +``` + -- Gitee From 67691c556e88706172d9b84afac16913dd55cf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Sun, 27 Nov 2022 13:18:10 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 翁章彬 <2629351295@qq.com> --- ...50\346\240\274\347\274\226\350\276\221.md" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-24 \345\234\250\347\272\277\350\241\250\346\240\274\347\274\226\350\276\221.md" diff --git "a/01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-24 \345\234\250\347\272\277\350\241\250\346\240\274\347\274\226\350\276\221.md" "b/01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-24 \345\234\250\347\272\277\350\241\250\346\240\274\347\274\226\350\276\221.md" new file mode 100644 index 0000000..22d4425 --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/\344\275\234\344\270\232/2022-11-24 \345\234\250\347\272\277\350\241\250\346\240\274\347\274\226\350\276\221.md" @@ -0,0 +1,23 @@ +```html + +``` + -- Gitee