ホームページ ウェブフロントエンド jsチュートリアル jQuery ユーザーマニュアル (6)_jquery

jQuery ユーザーマニュアル (6)_jquery

May 16, 2016 pm 06:45 PM
jquery マニュアル

:事件处理

 hover(Function, Function)    当鼠标move over时触发第一个function,当鼠标move out时触发第二个function
样式:
Html代码:
sdf

jQuery代码及效果
$(function(){
  $(
"#a").hover(function(){$(this).addClass("red");},
                           
function(){ $(this).removeClass("red"); 
                          });
})
最终效果是当鼠标移到id为a的层上时图层增加一个red样式,离开层时移出red样式

toggle(Function, Function)    当匹配元素第一次被点击时触发第一个函数,当第二次被点击时触发第二个函数
样式:
Html代码:
sdf

jQuery代码及效果
$(function(){
  $(
"#a"). toggle (function(){$(this).addClass("red");},
                             
function(){ $(this).removeClass("red"); 
                            });
})
The final effect is that when the mouse clicks on the layer with id a, the layer adds a red style, and when leaving the layer, the red style is removed

bind(type, fn) The user will The event and the way the event is triggered are bound to the matching object.
trigger(type) The user triggers an event in the form of type. $("p").trigger("click")
Also:unbind() unbind(type) unbind(type, fn)

Dynamic event(Function) A shortcut way to bind and unbind provided functions
Example:
$("#a").bind(" click",function() { 🎜>
).addClass(
"red");}) can also be written like this :
$(
"
#a").click(function () { 🎜>);});
The final effect is that when the mouse clicks on the layer with id a, the layer adds a red style.
The function provided by jQuery is used for browsers eventerror(fn) load(fn) unload(fn) resize(fn) scroll(fn)
for form event

change(fn) select(fn) submit(fn)

for keyboard event

keydown
(fn) keypress(fn) keyup(fn)


for mouse event
click(fn) dblclick(fn) mousedown(fn ) mousemove(fn)
mouseout(fn) mouseover(fn) mouseup(fn)
Used for UI eventsblur(fn) focus(fn)
The expansion of the above events is further expanded to 5 categories
For example, click(fn) extends click() unclick() oneclick(fn) unclick(fn)click(fn): Add an event that triggers a function when clickedclick(): Matching can be performed in other events The click event of the object.
unclick (): Do not execute the click event of the matching object. oneclick(fn): Only add a click event that can be executed once.
unclick (fn): Add an event that does not trigger a function when clicked.
The events listed above for browsers, forms, keyboards, mice, and UI can all be expanded according to the above methods.


このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

jQueryのリファレンスメソッドを詳しく解説:クイックスタートガイド jQueryのリファレンスメソッドを詳しく解説:クイックスタートガイド Feb 27, 2024 pm 06:45 PM

jQueryのリファレンスメソッドを詳しく解説:クイックスタートガイド

jQueryでPUTリクエストメソッドを使用するにはどうすればよいですか? jQueryでPUTリクエストメソッドを使用するにはどうすればよいですか? Feb 28, 2024 pm 03:12 PM

jQueryでPUTリクエストメソッドを使用するにはどうすればよいですか?

jQueryで要素の高さ属性を削除するにはどうすればよいですか? jQueryで要素の高さ属性を削除するにはどうすればよいですか? Feb 28, 2024 am 08:39 AM

jQueryで要素の高さ属性を削除するにはどうすればよいですか?

jQuery のヒント: ページ上のすべての a タグのテキストをすばやく変更する jQuery のヒント: ページ上のすべての a タグのテキストをすばやく変更する Feb 28, 2024 pm 09:06 PM

jQuery のヒント: ページ上のすべての a タグのテキストをすばやく変更する

jQuery を使用してすべての a タグのテキスト コンテンツを変更する jQuery を使用してすべての a タグのテキスト コンテンツを変更する Feb 28, 2024 pm 05:42 PM

jQuery を使用してすべての a タグのテキスト コンテンツを変更する

DingTalk PC版ユーザーマニュアルの見方 - DingTalk PC版ユーザーマニュアルの見方 DingTalk PC版ユーザーマニュアルの見方 - DingTalk PC版ユーザーマニュアルの見方 Mar 06, 2024 am 11:37 AM

DingTalk PC版ユーザーマニュアルの見方 - DingTalk PC版ユーザーマニュアルの見方

jQuery における eq の役割と応用シナリオを理解する jQuery における eq の役割と応用シナリオを理解する Feb 28, 2024 pm 01:15 PM

jQuery における eq の役割と応用シナリオを理解する

jQuery 要素に特定の属性があるかどうかを確認するにはどうすればよいですか? jQuery 要素に特定の属性があるかどうかを確認するにはどうすればよいですか? Feb 29, 2024 am 09:03 AM

jQuery 要素に特定の属性があるかどうかを確認するにはどうすればよいですか?

See all articles