mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 20:51:21 +08:00
648 lines
119 KiB
HTML
648 lines
119 KiB
HTML
<!doctype html>
|
||
<html lang="en" data-color-mode="dark">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>jQuery 备忘清单
|
||
& jquery cheatsheet & Quick Reference</title>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<meta description="jQuery 备忘单对于初学者和有经验的开发人员都是很好的参考
|
||
|
||
入门,为开发人员分享快速参考备忘单。">
|
||
<meta keywords="jquery,reference,Quick,Reference,cheatsheet,cheat,sheet">
|
||
<link rel="icon" href="data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%221em%22%20width%3D%221em%22%3E%20%3Cpath%20d%3D%22m21.66%2010.44-.98%204.18c-.84%203.61-2.5%205.07-5.62%204.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2%201.17-2.42%203.16-3.07%206.5-2.28l1.67.39c4.19.98%205.47%203.05%204.49%207.23Z%22%20fill%3D%22%23c9d1d9%22%2F%3E%20%3Cpath%20d%3D%22M15.06%2019.39c-.62.42-1.4.77-2.35%201.08l-1.58.52c-3.97%201.28-6.06.21-7.35-3.76L2.5%2013.28c-1.28-3.97-.22-6.07%203.75-7.35l1.58-.52c.41-.13.8-.24%201.17-.31-.3.61-.54%201.35-.74%202.2l-.98%204.19c-.98%204.18.31%206.24%204.48%207.23l1.68.4c.58.14%201.12.23%201.62.27Zm2.43-8.88c-.06%200-.12-.01-.19-.02l-4.85-1.23a.75.75%200%200%201%20.37-1.45l4.85%201.23a.748.748%200%200%201-.18%201.47Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3Cpath%20d%3D%22M14.56%2013.89c-.06%200-.12-.01-.19-.02l-2.91-.74a.75.75%200%200%201%20.37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3C%2Fsvg%3E" type="image/svg+xml">
|
||
<link rel="stylesheet" href="../style/style.css">
|
||
<link rel="stylesheet" href="../style/katex.css">
|
||
</head>
|
||
<body><nav class="header-nav"><div class="max-container"><a href="../index.html" class="logo"><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
|
||
<path d="m21.66 10.44-.98 4.18c-.84 3.61-2.5 5.07-5.62 4.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2 1.17-2.42 3.16-3.07 6.5-2.28l1.67.39c4.19.98 5.47 3.05 4.49 7.23Z" fill="#c9d1d9"></path>
|
||
<path d="M15.06 19.39c-.62.42-1.4.77-2.35 1.08l-1.58.52c-3.97 1.28-6.06.21-7.35-3.76L2.5 13.28c-1.28-3.97-.22-6.07 3.75-7.35l1.58-.52c.41-.13.8-.24 1.17-.31-.3.61-.54 1.35-.74 2.2l-.98 4.19c-.98 4.18.31 6.24 4.48 7.23l1.68.4c.58.14 1.12.23 1.62.27Zm2.43-8.88c-.06 0-.12-.01-.19-.02l-4.85-1.23a.75.75 0 0 1 .37-1.45l4.85 1.23a.748.748 0 0 1-.18 1.47Z" fill="#228e6c"></path>
|
||
<path d="M14.56 13.89c-.06 0-.12-.01-.19-.02l-2.91-.74a.75.75 0 0 1 .37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z" fill="#228e6c"></path>
|
||
</svg>
|
||
<span class="title">Quick Reference</span></a><div class="menu"><a href="javascript:void(0);" class="searchbtn" id="searchbtn"><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
|
||
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
|
||
</svg><span>搜索</span><span>⌘K</span></a><a href="https://github.com/jaywcjlove/reference/blob/main/docs/jquery.md" class="" target="__blank"><svg viewBox="0 0 36 36" fill="currentColor" height="1em" width="1em"><path d="m33 6.4-3.7-3.7a1.71 1.71 0 0 0-2.36 0L23.65 6H6a2 2 0 0 0-2 2v22a2 2 0 0 0 2 2h22a2 2 0 0 0 2-2V11.76l3-3a1.67 1.67 0 0 0 0-2.36ZM18.83 20.13l-4.19.93 1-4.15 9.55-9.57 3.23 3.23ZM29.5 9.43 26.27 6.2l1.85-1.85 3.23 3.23Z"></path><path fill="none" d="M0 0h36v36H0z"></path></svg><span>编辑</span></a><button id="darkMode" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="light" height="1em" width="1em">
|
||
<path d="M6.995 12c0 2.761 2.246 5.007 5.007 5.007s5.007-2.246 5.007-5.007-2.246-5.007-5.007-5.007S6.995 9.239 6.995 12zM11 19h2v3h-2zm0-17h2v3h-2zm-9 9h3v2H2zm17 0h3v2h-3zM5.637 19.778l-1.414-1.414 2.121-2.121 1.414 1.414zM16.242 6.344l2.122-2.122 1.414 1.414-2.122 2.122zM6.344 7.759 4.223 5.637l1.415-1.414 2.12 2.122zm13.434 10.605-1.414 1.414-2.122-2.122 1.414-1.414z"></path>
|
||
</svg>
|
||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" class="dark" height="1em" width="1em">
|
||
<path d="M12 11.807A9.002 9.002 0 0 1 10.049 2a9.942 9.942 0 0 0-5.12 2.735c-3.905 3.905-3.905 10.237 0 14.142 3.906 3.906 10.237 3.905 14.143 0a9.946 9.946 0 0 0 2.735-5.119A9.003 9.003 0 0 1 12 11.807z"></path>
|
||
</svg>
|
||
</button><script src="../js/dark.js?v=1.5.5"></script><a href="https://github.com/jaywcjlove/reference" class="" target="__blank"><svg viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></div></div></nav><div class="wrap h1body-exist max-container"><header class="wrap-header h1wrap"><h1 id="jquery-备忘清单"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
|
||
<path d="M1.525 5.87c-2.126 3.054-1.862 7.026-.237 10.269.037.079.078.154.118.229.023.052.049.1.077.15.013.027.031.056.047.082.026.052.054.102.081.152l.157.266c.03.049.057.097.09.146.056.094.12.187.178.281.026.04.05.078.079.117a6.368 6.368 0 0 0 .31.445c.078.107.156.211.24.315.027.038.058.076.086.115l.22.269c.028.03.055.067.084.099.098.118.202.233.306.35l.005.006a3.134 3.134 0 0 0 .425.44c.08.083.16.165.245.245l.101.097c.111.105.223.209.34.309.002 0 .003.002.005.003l.057.05c.102.089.205.178.31.26l.125.105c.085.068.174.133.26.2l.137.105c.093.07.192.139.287.207.035.025.07.05.106.073l.03.023.28.185.12.08c.148.094.294.184.44.272.041.02.084.044.123.068.108.062.22.125.329.183.06.034.122.063.184.094.075.042.153.083.234.125a.324.324 0 0 1 .056.023c.033.015.064.031.096.047.12.06.245.118.375.175.024.01.05.02.076.034.144.063.289.123.438.182.034.01.07.027.105.04.135.051.274.103.411.152l.05.018c.154.052.305.102.46.15.036.01.073.023.111.033.16.048.314.105.474.137 10.273 1.872 13.258-6.177 13.258-6.177-2.508 3.266-6.958 4.127-11.174 3.169-.156-.036-.312-.086-.47-.132a13.539 13.539 0 0 1-.567-.182l-.062-.024c-.136-.046-.267-.097-.4-.148a1.615 1.615 0 0 0-.11-.04c-.148-.06-.29-.121-.433-.184-.031-.01-.057-.024-.088-.036a23.44 23.44 0 0 1-.362-.17 1.485 1.485 0 0 1-.106-.052c-.094-.044-.188-.095-.28-.143a3.947 3.947 0 0 1-.187-.096c-.114-.06-.227-.125-.34-.187-.034-.024-.073-.044-.112-.066a15.922 15.922 0 0 1-.439-.27 2.107 2.107 0 0 1-.118-.078 6.01 6.01 0 0 1-.312-.207c-.035-.023-.067-.048-.103-.073a9.553 9.553 0 0 1-.295-.212c-.042-.034-.087-.066-.132-.1-.088-.07-.177-.135-.265-.208l-.118-.095a10.593 10.593 0 0 1-.335-.28.258.258 0 0 0-.037-.031l-.347-.316-.1-.094c-.082-.084-.166-.164-.25-.246l-.098-.1a9.081 9.081 0 0 1-.309-.323l-.015-.016c-.106-.116-.21-.235-.313-.355-.027-.03-.053-.064-.08-.097l-.227-.277a21.275 21.275 0 0 1-.34-.449C2.152 11.79 1.306 7.384 3.177 3.771m4.943-.473c-1.54 2.211-1.454 5.169-.254 7.508a9.111 9.111 0 0 0 .678 1.133c.23.33.484.721.793.988.107.122.223.24.344.36l.09.09c.114.11.232.217.35.325l.016.013a9.867 9.867 0 0 0 .414.342c.034.023.063.05.096.073.14.108.282.212.428.316l.015.009c.062.045.128.086.198.13.028.018.06.042.09.06.106.068.21.132.318.197.017.007.032.016.048.023.09.055.188.108.282.157.033.02.065.035.1.054.066.033.132.068.197.102l.032.014c.135.067.273.129.408.19.034.014.063.025.092.039.111.048.224.094.336.137.05.017.097.037.144.052.102.038.21.073.31.108l.14.045c.147.045.295.104.449.13C22.164 17.206 24 11.098 24 11.098c-1.653 2.38-4.852 3.513-8.261 2.628a8.04 8.04 0 0 1-.449-.13c-.048-.014-.09-.029-.136-.043-.104-.036-.211-.07-.312-.109l-.144-.054c-.113-.045-.227-.087-.336-.135-.034-.015-.065-.025-.091-.04-.14-.063-.281-.125-.418-.192l-.206-.107-.119-.06a5.673 5.673 0 0 1-.265-.15.62.62 0 0 1-.062-.035c-.106-.066-.217-.13-.318-.198-.034-.019-.065-.042-.097-.062l-.208-.136c-.144-.1-.285-.208-.428-.313-.032-.029-.063-.053-.094-.079-1.499-1.178-2.681-2.79-3.242-4.613-.59-1.897-.46-4.023.56-5.75m4.292-.147c-.909 1.334-.996 2.99-.37 4.46.665 1.563 2.024 2.79 3.608 3.37.065.025.128.046.196.07l.088.027c.092.03.185.063.28.084 4.381.845 5.567-2.25 5.886-2.704-1.043 1.498-2.792 1.857-4.938 1.335a4.85 4.85 0 0 1-.516-.16 6.352 6.352 0 0 1-.618-.254 6.53 6.53 0 0 1-1.082-.66c-1.922-1.457-3.113-4.236-1.859-6.5"></path>
|
||
</svg>
|
||
<a aria-hidden="true" tabindex="-1" href="#jquery-备忘清单"><span class="icon icon-link"></span></a>jQuery 备忘清单</h1><div class="wrap-body">
|
||
<p><a href="https://jquery.com/">jQuery</a> 备忘单对于初学者和有经验的开发人员都是很好的参考</p>
|
||
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
|
||
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
|
||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#引入-jquery">引入 jQuery</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#官方-cdn">官方 CDN</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#jquery-语法">jQuery 语法</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#例子">例子</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#jquery-文档准备就绪">jQuery 文档准备就绪</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-选择器">jQuery 选择器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#例子-1">例子</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#组合选择器">组合选择器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#基本">基本</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#基本过滤器">基本过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#属性">属性</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#子过滤器">子过滤器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#forms">Forms</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-属性">jQuery 属性</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#例子-2">例子</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#jquery-添加类">jQuery 添加类</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#jquery-移除类">jQuery 移除类</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#jquery-切换类">jQuery 切换类</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#attributes">Attributes</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#data">Data</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#css">CSS</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dimensions">Dimensions</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#offset">Offset</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-操控">jQuery 操控</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#examples">Examples</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#复刻">复刻</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dom-插入环绕">DOM 插入,环绕</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dom-插入内部">DOM 插入,内部</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dom-插入外部">DOM 插入,外部</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dom-移除">DOM 移除</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dom-替换">DOM 替换</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-遍历">jQuery 遍历</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#过滤">过滤</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#杂项遍历">杂项遍历</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#树遍历">树遍历</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-事件">jQuery 事件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#examples-1">Examples</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#事件对象">事件对象</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#方法链">方法链</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#防止事件">防止事件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#浏览器事件">浏览器事件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#事件对象-1">事件对象</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#文档加载">文档加载</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#事件处理程序附件">事件处理程序附件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#形式事件">形式事件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#键盘事件">键盘事件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#鼠标事件">鼠标事件</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-effects">jQuery Effects</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#例子-3">例子</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#淡出效果">淡出效果</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#基本-1">基本</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#滑动">滑动</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#自定义">自定义</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#衰退">衰退</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#jquery-ajax">jQuery Ajax</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#examples-2">Examples</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#全局-ajax-事件处理程序">全局 Ajax 事件处理程序</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#辅助功能">辅助功能</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#底层接口">底层接口</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#速记方法">速记方法</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#各种各样的">各种各样的</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#jquery-对象">jQuery 对象</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#延迟对象">延迟对象</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#公用事业">公用事业</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#dom-元素方法">DOM 元素方法</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#内部结构">内部结构</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#回调对象">回调对象</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="引入-jquery"><a aria-hidden="true" tabindex="-1" href="#引入-jquery"><span class="icon icon-link"></span></a>引入 jQuery</h3><div class="wrap-body">
|
||
<pre class="wrap-text"><code class="language-js code-highlight"><span class="code-line"><span class="token operator"><</span>script src<span class="token operator">=</span><span class="token string">"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"</span><span class="token operator">></span><span class="token operator"><</span><span class="token operator">/</span>script<span class="token operator">></span>
|
||
</span></code></pre>
|
||
<!--rehype:className=wrap-text-->
|
||
<h4 id="官方-cdn"><a aria-hidden="true" tabindex="-1" href="#官方-cdn"><span class="icon icon-link"></span></a>官方 CDN</h4>
|
||
<pre class="wrap-text"><code class="language-js code-highlight"><span class="code-line"><span class="token operator"><</span>script src<span class="token operator">=</span><span class="token string">"https://code.jquery.com/jquery-3.5.1.min.js"</span> crossorigin<span class="token operator">=</span><span class="token string">"anonymous"</span><span class="token operator">></span><span class="token operator"><</span><span class="token operator">/</span>script<span class="token operator">></span>
|
||
</span></code></pre>
|
||
<!--rehype:className=wrap-text-->
|
||
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="jquery-语法"><a aria-hidden="true" tabindex="-1" href="#jquery-语法"><span class="icon icon-link"></span></a>jQuery 语法</h3><div class="wrap-body">
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span>selector<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">methodOrFunction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="例子"><a aria-hidden="true" tabindex="-1" href="#例子"><span class="icon icon-link"></span></a>例子</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span><span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">hide</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">"body"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">css</span><span class="token punctuation">(</span><span class="token string">"background"</span><span class="token punctuation">,</span> <span class="token string">"red"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="jquery-文档准备就绪"><a aria-hidden="true" tabindex="-1" href="#jquery-文档准备就绪"><span class="icon icon-link"></span></a>jQuery 文档准备就绪</h3><div class="wrap-body">
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token dom variable">document</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">ready</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token comment">// 在加载 DOM 后运行</span>
|
||
</span><span class="code-line"> <span class="token function">alert</span><span class="token punctuation">(</span><span class="token string">'DOM fully loaded!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token comment">// 在加载 DOM 后运行</span>
|
||
</span><span class="code-line"> <span class="token function">alert</span><span class="token punctuation">(</span><span class="token string">'DOM fully loaded!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-选择器"><a aria-hidden="true" tabindex="-1" href="#jquery-选择器"><span class="icon icon-link"></span></a>jQuery 选择器</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="例子-1"><a aria-hidden="true" tabindex="-1" href="#例子-1"><span class="icon icon-link"></span></a>例子</h3><div class="wrap-body">
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">"button"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">click</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">":button"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">css</span><span class="token punctuation">(</span><span class="token string">"color"</span><span class="token punctuation">,</span> <span class="token string">"red"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="组合选择器"><a aria-hidden="true" tabindex="-1" href="#组合选择器"><span class="icon icon-link"></span></a>组合选择器</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">"selector1, selector2 ...selectorn"</span><span class="token punctuation">)</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="基本"><a aria-hidden="true" tabindex="-1" href="#基本"><span class="icon icon-link"></span></a>基本</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/all-selector/" class="tooltip">*<em class="tooltiptext">选择所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/class-selector/" class="tooltip">.class<em class="tooltiptext">选择具有给定类的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/element-selector/" class="tooltip">element<em class="tooltiptext">选择具有给定标签名称的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/id-selector/" class="tooltip">#id<em class="tooltiptext">选择具有给定 id 属性的单个元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/hidden-selector/" class="tooltip">:hidden<em class="tooltiptext">选择所有隐藏的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/visible-selector/" class="tooltip">:visible<em class="tooltiptext">选择所有可见的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/contains-selector/" class="tooltip">:contains()<em class="tooltiptext">选择包含指定文本的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/empty-selector/" class="tooltip">:empty<em class="tooltiptext">选择所有没有子元素的元素(包括文本节点)</em></a></li>
|
||
<li><a href="https://api.jquery.com/has-selector/" class="tooltip">:has()<em class="tooltiptext">选择至少包含一个与指定选择器匹配的元素的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/parent-selector/" class="tooltip">:parent<em class="tooltiptext">选择具有至少一个子节点(元素或文本)的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/child-selector/" class="tooltip">parent > child<em class="tooltiptext">选择由父元素指定的子元素指定的所有直接子元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/descendant-selector/" class="tooltip">ancestor descendant<em class="tooltiptext">选择作为给定祖先的后代的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/next-adjacent-Selector/" class="tooltip">prev + next<em class="tooltiptext">选择所有与 next 匹配且紧接在其前面的同级 prev 的下一个元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/next-siblings-selector/" class="tooltip">prev ~ siblings<em class="tooltiptext">选择 prev 元素之后的所有同级元素,具有相同的父元素,并匹配过滤同级选择器</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="基本过滤器"><a aria-hidden="true" tabindex="-1" href="#基本过滤器"><span class="icon icon-link"></span></a>基本过滤器</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/animated-selector/" class="tooltip">:animated<em class="tooltiptext">在运行选择器时选择动画进度中的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/eq-selector/" class="tooltip">:eq()<em class="tooltiptext">选择匹配集中索引 n 处的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/even-selector/" class="tooltip">:even<em class="tooltiptext">选择偶数元素,索引为零。 另见:奇数</em></a></li>
|
||
<li><a href="https://api.jquery.com/first-selector/" class="tooltip">:first<em class="tooltiptext">选择第一个匹配的 DOM 元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/gt-selector/" class="tooltip">:gt()<em class="tooltiptext">选择匹配集中索引大于索引的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/header-selector/" class="tooltip">:header<em class="tooltiptext">选择所有标题元素,如 h1、h2、h3 等</em></a></li>
|
||
<li><a href="https://api.jquery.com/lang-selector/" class="tooltip">:lang()<em class="tooltiptext">选择指定语言的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/last-selector/" class="tooltip">:last<em class="tooltiptext">选择最后一个匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/lt-selector/" class="tooltip">:lt()<em class="tooltiptext">选择匹配集中索引小于索引的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/not-selector/" class="tooltip">:not()<em class="tooltiptext">选择与给定选择器不匹配的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/odd-selector/" class="tooltip">:odd<em class="tooltiptext">选择奇数元素,索引为零。 另见:甚至</em></a></li>
|
||
<li><a href="https://api.jquery.com/root-selector/" class="tooltip">:root<em class="tooltiptext">选择作为文档根的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/target-selector/" class="tooltip">:target<em class="tooltiptext">选择由文档的 URI 的片段标识符指示的目标元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="属性"><a aria-hidden="true" tabindex="-1" href="#属性"><span class="icon icon-link"></span></a>属性</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/attribute-contains-prefix-selector/" class="tooltip">[name|="value"]<em class="tooltiptext">选择具有指定属性且值等于给定字符串或以该字符串开头后跟连字符 (-) 的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/attribute-contains-selector/" class="tooltip">[name*="value"]<em class="tooltiptext">选择具有指定属性且值包含给定子字符串的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/attribute-contains-word-selector/" class="tooltip">[name~="value"]<em class="tooltiptext">选择具有指定属性的元素,其值包含给定单词,由空格分隔</em></a></li>
|
||
<li><a href="https://api.jquery.com/attribute-ends-with-selector/" class="tooltip">[name$="value"]<em class="tooltiptext">选择具有指定属性且值恰好以给定字符串结尾的元素。 比较区分大小写</em></a></li>
|
||
<li><a href="https://api.jquery.com/attribute-equals-selector/" class="tooltip">[name="value"]<em class="tooltiptext">选择具有指定属性且值恰好等于特定值的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/attribute-not-equal-selector/" class="tooltip">[name!="value"]<em class="tooltiptext">选择不具有指定属性或具有指定属性但不具有特定值的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/attribute-starts-with-selector/" class="tooltip">[name^="value"]<em class="tooltiptext">选择具有指定属性且值恰好以给定字符串开头的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/has-attribute-selector/" class="tooltip">[name]<em class="tooltiptext">选择具有指定属性和任意值的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/multiple-attribute-selector/" class="tooltip">[name="value"]<em class="tooltiptext">匹配匹配所有指定属性过滤器的元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="子过滤器"><a aria-hidden="true" tabindex="-1" href="#子过滤器"><span class="icon icon-link"></span></a>子过滤器</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/first-child-selector/" class="tooltip">:first-child<em class="tooltiptext">选择作为其父元素的第一个子元素的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/first-of-type-selector/" class="tooltip">:first-of-type<em class="tooltiptext">选择具有相同元素名称的兄弟姐妹中第一个的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/last-child-selector/" class="tooltip">:last-child<em class="tooltiptext">选择作为其父元素的最后一个子元素的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/last-of-type-selector/" class="tooltip">:last-of-type<em class="tooltiptext">选择具有相同元素名称的兄弟中最后一个的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/nth-child-selector/" class="tooltip">:nth-child()<em class="tooltiptext">选择作为其父元素的第 n 个子元素的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/nth-last-child-selector/" class="tooltip">:nth-last-child()<em class="tooltiptext">选择作为其父元素的第 n 个子元素的所有元素,从最后一个元素到第一个元素计数</em></a></li>
|
||
<li><a href="https://api.jquery.com/nth-last-of-type-selector/" class="tooltip">:nth-last-of-type()<em class="tooltiptext">选择所有元素,这些元素是其父元素的第 n 个子元素,相对于具有相同元素名称的兄弟元素,从最后一个元素到第一个元素计数</em></a></li>
|
||
<li><a href="https://api.jquery.com/nth-of-type-selector/" class="tooltip">:nth-of-type()<em class="tooltiptext">选择所有元素,这些元素是其父元素相对于具有相同元素名称的兄弟元素的第 n 个子元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/only-child-selector/" class="tooltip">:only-child<em class="tooltiptext">选择作为其父元素的唯一子元素的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/only-of-type-selector/" class="tooltip">:only-of-type()<em class="tooltiptext">选择所有没有同名元素的元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="forms"><a aria-hidden="true" tabindex="-1" href="#forms"><span class="icon icon-link"></span></a>Forms</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/button-selector/" class="tooltip">:button<em class="tooltiptext">选择所有按钮元素和按钮类型的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/checkbox-selector/" class="tooltip">:checkbox<em class="tooltiptext">选择复选框类型的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/checked-selector/" class="tooltip">:checked<em class="tooltiptext">匹配所有选中或选择的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/disabled-selector/" class="tooltip">:disabled<em class="tooltiptext">选择所有禁用的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/enabled-selector/" class="tooltip">:enabled<em class="tooltiptext">选择所有启用的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/focus-selector/" class="tooltip">:focus<em class="tooltiptext">如果当前获得焦点,则选择元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/file-selector/" class="tooltip">:file<em class="tooltiptext">选择类型文件的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/image-selector/" class="tooltip">:image<em class="tooltiptext">选择图像类型的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/input-selector/" class="tooltip">:input<em class="tooltiptext">选择所有输入、文本区域、选择和按钮元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/password-selector/" class="tooltip">:password<em class="tooltiptext">选择密码类型的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/radio-selector/" class="tooltip">:radio<em class="tooltiptext">选择无线电类型的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/reset-selector/" class="tooltip">:reset<em class="tooltiptext">选择重置类型的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/selected-selector/" class="tooltip">:selected<em class="tooltiptext">选择所有选中的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/submit-selector/" class="tooltip">:submit<em class="tooltiptext">选择提交类型的所有元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/text-selector/" class="tooltip">:text<em class="tooltiptext">选择文本类型的所有输入元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-属性"><a aria-hidden="true" tabindex="-1" href="#jquery-属性"><span class="icon icon-link"></span></a>jQuery 属性</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="例子-2"><a aria-hidden="true" tabindex="-1" href="#例子-2"><span class="icon icon-link"></span></a>例子</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-2-->
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'h2'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">css</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token literal-property property">color</span><span class="token operator">:</span> <span class="token string">'blue'</span><span class="token punctuation">,</span>
|
||
</span><span class="code-line"> <span class="token literal-property property">backgroundColor</span><span class="token operator">:</span> <span class="token string">'gray'</span><span class="token punctuation">,</span>
|
||
</span><span class="code-line"> <span class="token literal-property property">fontSize</span><span class="token operator">:</span> <span class="token string">'24px'</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="jquery-添加类"><a aria-hidden="true" tabindex="-1" href="#jquery-添加类"><span class="icon icon-link"></span></a>jQuery 添加类</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'.button'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">addClass</span><span class="token punctuation">(</span><span class="token string">'active'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="jquery-移除类"><a aria-hidden="true" tabindex="-1" href="#jquery-移除类"><span class="icon icon-link"></span></a>jQuery 移除类</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'.button'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'mouseleave'</span><span class="token punctuation">,</span> <span class="token parameter">evt</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token keyword">let</span> e <span class="token operator">=</span> evt<span class="token punctuation">.</span><span class="token property-access">currentTarget</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">removeClass</span><span class="token punctuation">(</span><span class="token string">'active'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="jquery-切换类"><a aria-hidden="true" tabindex="-1" href="#jquery-切换类"><span class="icon icon-link"></span></a>jQuery 切换类</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'.choice'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">toggleClass</span><span class="token punctuation">(</span><span class="token string">'highlighted'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="attributes"><a aria-hidden="true" tabindex="-1" href="#attributes"><span class="icon icon-link"></span></a>Attributes</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/attr/" class="tooltip">.attr()<em class="tooltiptext">获取匹配元素集中第一个元素的属性值</em></a></li>
|
||
<li><a href="https://api.jquery.com/prop/" class="tooltip">.prop()<em class="tooltiptext">获取匹配元素集中第一个元素的属性值</em></a></li>
|
||
<li><a href="https://api.jquery.com/removeAttr/" class="tooltip">.removeAttr()<em class="tooltiptext">从匹配元素集中的每个元素中删除一个属性</em></a></li>
|
||
<li><a href="https://api.jquery.com/removeProp/" class="tooltip">.removeProp()<em class="tooltiptext">删除匹配元素集的属性</em></a></li>
|
||
<li><a href="https://api.jquery.com/val/" class="tooltip">.val()<em class="tooltiptext">获取匹配元素集中第一个元素的当前值</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
<h4 id="data"><a aria-hidden="true" tabindex="-1" href="#data"><span class="icon icon-link"></span></a>Data</h4>
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.data/" class="tooltip">jQuery.data()<em class="tooltiptext">存储与指定元素关联的任意数据。 返回设置的值</em></a></li>
|
||
<li><a href="https://api.jquery.com/data/" class="tooltip">.data()<em class="tooltiptext">存储与匹配元素关联的任意数据</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.hasData/" class="tooltip">jQuery.hasData()<em class="tooltiptext">确定一个元素是否有任何与之关联的 jQuery 数据</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.removeData/" class="tooltip">jQuery.removeData()<em class="tooltiptext">删除以前存储的数据</em></a></li>
|
||
<li><a href="https://api.jquery.com/removeData/" class="tooltip">.removeData()<em class="tooltiptext">删除以前存储的数据</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="css"><a aria-hidden="true" tabindex="-1" href="#css"><span class="icon icon-link"></span></a>CSS</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/addClass/" class="tooltip">.addClass()<em class="tooltiptext">将指定的类添加到匹配元素集中的每个元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/hasClass/" class="tooltip">.hasClass()<em class="tooltiptext">确定是否有任何匹配的元素被分配给给定的类</em></a></li>
|
||
<li><a href="https://api.jquery.com/removeClass/" class="tooltip">.removeClass()<em class="tooltiptext">从匹配元素集中的每个元素中删除单个类、多个类或所有类</em></a></li>
|
||
<li><a href="https://api.jquery.com/toggleClass/" class="tooltip">.toggleClass()<em class="tooltiptext">根据类的存在或状态参数的值,从匹配元素集中的每个元素添加或删除一个或多个类</em></a></li>
|
||
<li><a href="https://api.jquery.com/css/" class="tooltip">.css()<em class="tooltiptext">获取匹配元素集中第一个元素的计算样式属性</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.cssHooks/" class="tooltip">jQuery.cssHooks<em class="tooltiptext">直接连接到 jQuery 以覆盖特定 CSS 属性的检索或设置方式、标准化 CSS 属性命名或创建自定义属性</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.cssNumber/" class="tooltip">jQuery.cssNumber<em class="tooltiptext">包含所有可以在没有单位的情况下使用的 CSS 属性的对象。<code>.css()</code> 方法使用此对象来查看它是否可以将 px 附加到无单位值</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.escapeSelector/" class="tooltip">jQuery.escapeSelector()<em class="tooltiptext">转义任何在 CSS 选择器中具有特殊含义的字符</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dimensions"><a aria-hidden="true" tabindex="-1" href="#dimensions"><span class="icon icon-link"></span></a>Dimensions</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/height/" class="tooltip">.height()<em class="tooltiptext">获取匹配元素集中第一个元素的当前计算高度</em></a></li>
|
||
<li><a href="https://api.jquery.com/innerHeight/" class="tooltip">.innerHeight()<em class="tooltiptext">获取匹配元素集中第一个元素的当前计算高度,包括填充但不包括边框</em></a></li>
|
||
<li><a href="https://api.jquery.com/innerWidth/" class="tooltip">.innerWidth()<em class="tooltiptext">获取匹配元素集中第一个元素的当前计算内部宽度,包括填充但不包括边框</em></a></li>
|
||
<li><a href="https://api.jquery.com/outerHeight/" class="tooltip">.outerHeight()<em class="tooltiptext">获取匹配元素集中第一个元素的当前计算外部高度(包括填充、边框和可选的边距)</em></a></li>
|
||
<li><a href="https://api.jquery.com/outerWidth/" class="tooltip">.outerWidth()<em class="tooltiptext">获取匹配元素集中第一个元素的当前计算外部宽度(包括填充、边框和可选的边距)</em></a></li>
|
||
<li><a href="https://api.jquery.com/width/" class="tooltip">.width()<em class="tooltiptext">获取匹配元素集中第一个元素的当前计算宽度</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="offset"><a aria-hidden="true" tabindex="-1" href="#offset"><span class="icon icon-link"></span></a>Offset</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/offset/" class="tooltip">.offset()<em class="tooltiptext">获取匹配元素集中第一个元素相对于文档的当前坐标</em></a></li>
|
||
<li><a href="https://api.jquery.com/offsetParent/" class="tooltip">.offsetParent()<em class="tooltiptext">获取定位的最近的祖先元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/position/" class="tooltip">.position()<em class="tooltiptext">获取匹配元素集中第一个元素相对于偏移父元素的当前坐标</em></a></li>
|
||
<li><a href="https://api.jquery.com/scrollLeft/" class="tooltip">.scrollLeft()<em class="tooltiptext">获取匹配元素集中第一个元素的滚动条的当前水平位置</em></a></li>
|
||
<li><a href="https://api.jquery.com/scrollTop/" class="tooltip">.scrollTop()<em class="tooltiptext">获取匹配元素集中第一个元素的滚动条的当前垂直位置,或为每个匹配元素设置滚动条的垂直位置</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-操控"><a aria-hidden="true" tabindex="-1" href="#jquery-操控"><span class="icon icon-link"></span></a>jQuery 操控</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist row-span-3"><div class="wrap-header h3wrap"><h3 id="examples"><a aria-hidden="true" tabindex="-1" href="#examples"><span class="icon icon-link"></span></a>Examples</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-3-->
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token comment">/*<span>Span.</span>*/</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'span'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">after</span><span class="token punctuation">(</span><span class="token string">'<p>Paragraph.</p>'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token comment">/*<span>Span.</span><p>Paragraph.</p>*/</span>
|
||
</span><span class="code-line"><span class="token comment">/*<span>Span.</span>*/</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'<span>Span.</span>'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">replaceAll</span><span class="token punctuation">(</span><span class="token string">'p'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token comment">/*<p>Span.</p>*/</span>
|
||
</span><span class="code-line"><span class="token comment">/*<span>This is span.</span>*/</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'span'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">wrap</span><span class="token punctuation">(</span><span class="token string">'<p></p>'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token comment">/*<p><span>This is span.</span></p>*/</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="复刻"><a aria-hidden="true" tabindex="-1" href="#复刻"><span class="icon icon-link"></span></a>复刻</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/clone/" class="tooltip">.clone()<em class="tooltiptext">创建匹配元素集的深层副本</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dom-插入环绕"><a aria-hidden="true" tabindex="-1" href="#dom-插入环绕"><span class="icon icon-link"></span></a>DOM 插入,环绕</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/wrap/" class="tooltip">.wrap()<em class="tooltiptext">在匹配元素集中的每个元素周围包装一个 HTML 结构</em></a></li>
|
||
<li><a href="https://api.jquery.com/wrapAll/" class="tooltip">.wrapAll()<em class="tooltiptext">在匹配元素集中的所有元素周围包装一个 HTML 结构</em></a></li>
|
||
<li><a href="https://api.jquery.com/wrapInner/" class="tooltip">.wrapInner()<em class="tooltiptext">围绕匹配元素集中每个元素的内容包装一个 HTML 结构</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dom-插入内部"><a aria-hidden="true" tabindex="-1" href="#dom-插入内部"><span class="icon icon-link"></span></a>DOM 插入,内部</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/append/" class="tooltip">.append()<em class="tooltiptext">在匹配的元素集中,插入由参数指定的内容插入每个元素的末尾</em></a></li>
|
||
<li><a href="https://api.jquery.com/appendTo/" class="tooltip">.appendTo()<em class="tooltiptext">将匹配元素集中的每个元素插入目标末端</em></a></li>
|
||
<li><a href="https://api.jquery.com/html/" class="tooltip">.html()<em class="tooltiptext">在匹配元素集中获取第一个元素的HTML内容</em></a></li>
|
||
<li><a href="https://api.jquery.com/prepend/" class="tooltip">.prepend()<em class="tooltiptext">插入由参数指定的内容插入匹配元素集中每个元素的开始</em></a></li>
|
||
<li><a href="https://api.jquery.com/prependTo/" class="tooltip">.prependTo()<em class="tooltiptext">将匹配元素集中的每个元素插入目标开始</em></a></li>
|
||
<li><a href="https://api.jquery.com/text/" class="tooltip">.text()<em class="tooltiptext">在匹配的元素集(包括其后代)中获取每个元素的组合文本内容</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dom-插入外部"><a aria-hidden="true" tabindex="-1" href="#dom-插入外部"><span class="icon icon-link"></span></a>DOM 插入,外部</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/after/" class="tooltip">.after()<em class="tooltiptext">在匹配元素集中的每个元素之后,插入由参数指定的内容</em></a></li>
|
||
<li><a href="https://api.jquery.com/before/" class="tooltip">.before()<em class="tooltiptext">在匹配元素集中的每个元素之前,插入由参数指定的内容</em></a></li>
|
||
<li><a href="https://api.jquery.com/insertAfter/" class="tooltip">.insertAfter()<em class="tooltiptext">在目标之后插入匹配元素集中的每个元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/insertBefore/" class="tooltip">.insertBefore()<em class="tooltiptext">在目标之前插入匹配元素集中的每个元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dom-移除"><a aria-hidden="true" tabindex="-1" href="#dom-移除"><span class="icon icon-link"></span></a>DOM 移除</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/detach/" class="tooltip">.detach()<em class="tooltiptext">从DOM上删除一组匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/empty/" class="tooltip">.empty()<em class="tooltiptext">从DOM中删除一组匹配元素的所有子节点</em></a></li>
|
||
<li><a href="https://api.jquery.com/remove/" class="tooltip">.remove()<em class="tooltiptext">从DOM上删除一组匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/unwrap/" class="tooltip">.unwrap()<em class="tooltiptext">从DOM上删除一组匹配元素的父母,将匹配的元素留在其位置</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dom-替换"><a aria-hidden="true" tabindex="-1" href="#dom-替换"><span class="icon icon-link"></span></a>DOM 替换</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/replaceAll/" class="tooltip">.replaceAll()<em class="tooltiptext">用匹配的元素集替换每个目标元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/replaceWith/" class="tooltip">.replaceWith()<em class="tooltiptext">用提供的新内容替换一组匹配元素中的每个元素,然后返回已删除的元素集</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-遍历"><a aria-hidden="true" tabindex="-1" href="#jquery-遍历"><span class="icon icon-link"></span></a>jQuery 遍历</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="过滤"><a aria-hidden="true" tabindex="-1" href="#过滤"><span class="icon icon-link"></span></a>过滤</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/eq/" class="tooltip">.eq()<em class="tooltiptext">将匹配的元素集减少到指定索引处的集合</em></a></li>
|
||
<li><a href="https://api.jquery.com/filter/" class="tooltip">.filter()<em class="tooltiptext">将匹配的元素集减少到匹配选择器或传递函数测试的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/first/" class="tooltip">.first()<em class="tooltiptext">将匹配的元素集减少到集合中的第一个</em></a></li>
|
||
<li><a href="https://api.jquery.com/has/" class="tooltip">.has()<em class="tooltiptext">将匹配的元素集减少到具有与选择器或DOM元素相匹配的后代的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/is/" class="tooltip">.is()<em class="tooltiptext">检查当前匹配的元素与选择器,元素或jQuery对象的元素集,如果至少其中一个元素与给定参数匹配,则返回true</em></a></li>
|
||
<li><a href="https://api.jquery.com/last/" class="tooltip">.last()<em class="tooltiptext">将匹配的元素集减少到集合中的最后一个元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/map/" class="tooltip">.map()<em class="tooltiptext">将当前匹配的每个元素通过函数传递,从而产生包含返回值的新jQuery对象</em></a></li>
|
||
<li><a href="https://api.jquery.com/not/" class="tooltip">.not()<em class="tooltiptext">从匹配元素集中删除元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/slice/" class="tooltip">.slice()<em class="tooltiptext">将匹配的元素集减少为由一系列索引指定的子集</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="杂项遍历"><a aria-hidden="true" tabindex="-1" href="#杂项遍历"><span class="icon icon-link"></span></a>杂项遍历</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/add/" class="tooltip">.add()<em class="tooltiptext">创建一个新的jQuery对象,其中添加到匹配元素集中的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/addBack/" class="tooltip">.addBack()<em class="tooltiptext">将堆栈上的上一个元素添加到当前集合中,并由选择器进行过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/andSelf/" class="tooltip">.andSelf()<em class="tooltiptext">将堆栈上的先前元素添加到当前集合中</em></a></li>
|
||
<li><a href="https://api.jquery.com/contents/" class="tooltip">.contents()<em class="tooltiptext">在一组匹配元素中获取每个元素的孩子,包括文本和评论节点</em></a></li>
|
||
<li><a href="https://api.jquery.com/each/" class="tooltip">.each()<em class="tooltiptext">在jQuery对象上迭代,为每个匹配的元素执行一个函数</em></a></li>
|
||
<li><a href="https://api.jquery.com/end/" class="tooltip">.end()<em class="tooltiptext">结束当前链中最新的过滤操作,并将匹配元素集返回其先前状态</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="树遍历"><a aria-hidden="true" tabindex="-1" href="#树遍历"><span class="icon icon-link"></span></a>树遍历</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/children/" class="tooltip">.children()<em class="tooltiptext">在一组匹配元素中获取每个元素的孩子,并被选择器进行过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/closest/" class="tooltip">.closest()<em class="tooltiptext">对于集合中的每个元素,通过测试元素本身并通过其祖先在DOM树中的祖先进行遍历来获取与选择器匹配的第一个元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/find/" class="tooltip">.find()<em class="tooltiptext">在当前匹配元素集中获取每个元素的后代,并由选择器,jQuery对象或元素过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/next/" class="tooltip">.next()<em class="tooltiptext">在匹配的元素集中,立即获取每个元素的兄弟姐妹。 如果提供了选择器,则仅在匹配该选择器的情况下才能检索下一个兄弟姐妹</em></a></li>
|
||
<li><a href="https://api.jquery.com/nextAll/" class="tooltip">.nextAll()<em class="tooltiptext">在一组匹配元素中获取每个元素的所有以下兄弟姐妹,并由选择器进行过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/nextUntil/" class="tooltip">.nextUntil()<em class="tooltiptext">将每个元素的所有以下兄弟姐妹添加到,但不包括通过选择器,DOM节点或jQuery对象匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/parent/" class="tooltip">.parent()<em class="tooltiptext">在当前匹配元素集中获取每个元素的父,由选择器选择过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/parents/" class="tooltip">.parents()<em class="tooltiptext">在当前匹配元素集中获取每个元素的祖先,并被选择器进行过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/parentsUntil/" class="tooltip">.parentsUntil()<em class="tooltiptext">在当前匹配元素集中获取每个元素的祖先,直到但不包括由选择器,DOM节点或jQuery对象匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/prev/" class="tooltip">.prev()<em class="tooltiptext">在匹配元素集中获取每个元素的立即兄弟姐妹。 如果提供了选择器,则仅在匹配该选择器时才检索先前的同胞</em></a></li>
|
||
<li><a href="https://api.jquery.com/prevAll/" class="tooltip">.prevAll()<em class="tooltiptext">在一组匹配元素中获取每个元素的所有先前兄弟姐妹,并由选择器进行过滤</em></a></li>
|
||
<li><a href="https://api.jquery.com/prevUntil/" class="tooltip">.prevUntil()<em class="tooltiptext">将每个元素的所有先前兄弟姐妹添加到,但不包括由选择器,DOM节点或jQuery对象匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/siblings/" class="tooltip">.siblings()<em class="tooltiptext">在匹配的元素集中获取每个元素的兄弟姐妹,并被选择器进行过滤</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-事件"><a aria-hidden="true" tabindex="-1" href="#jquery-事件"><span class="icon icon-link"></span></a>jQuery 事件</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist row-span-6"><div class="wrap-header h3wrap"><h3 id="examples-1"><a aria-hidden="true" tabindex="-1" href="#examples-1"><span class="icon icon-link"></span></a>Examples</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-6-->
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token comment">// 鼠标事件“点击”</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu-button'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">show</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token comment">// 键盘事件“键盘”</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#textbox'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'keyup'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">show</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token comment">// 滚动事件“滚动”</span>
|
||
</span><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu-button'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'scroll'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">show</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="事件对象"><a aria-hidden="true" tabindex="-1" href="#事件对象"><span class="icon icon-link"></span></a>事件对象</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span> <span class="token parameter">event</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span>event<span class="token punctuation">.</span><span class="token property-access">currentTarget</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">hide</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="方法链"><a aria-hidden="true" tabindex="-1" href="#方法链"><span class="icon icon-link"></span></a>方法链</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu-btn'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'mouseenter'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">show</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'mouseleave'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">hide</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="防止事件"><a aria-hidden="true" tabindex="-1" href="#防止事件"><span class="icon icon-link"></span></a>防止事件</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span> <span class="token string">"p"</span> <span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">click</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span> <span class="token parameter">event</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> event<span class="token punctuation">.</span><span class="token method function property-access">stopPropagation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"> <span class="token comment">// Do something</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="浏览器事件"><a aria-hidden="true" tabindex="-1" href="#浏览器事件"><span class="icon icon-link"></span></a>浏览器事件</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/error/" class="tooltip">.error()<em class="tooltiptext">将事件处理程序绑定到错误 JavaScript 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/resize/" class="tooltip">.resize()<em class="tooltiptext">将事件处理程序绑定到调整大小的 JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/scroll/" class="tooltip">.scroll()<em class="tooltiptext">将事件处理程序绑定到滚动 JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist row-span-6"><div class="wrap-header h3wrap"><h3 id="事件对象-1"><a aria-hidden="true" tabindex="-1" href="#事件对象-1"><span class="icon icon-link"></span></a>事件对象</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-6-->
|
||
<ul class="style-none">
|
||
<li><a href="https://api.jquery.com/event.currentTarget/" class="tooltip">event.currentTarget<em class="tooltiptext">事件冒泡阶段中的当前 DOM 元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.delegateTarget/" class="tooltip">event.delegateTarget<em class="tooltiptext">附加了当前调用的 jQuery 事件处理程序的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.data/" class="tooltip">event.data<em class="tooltiptext">绑定当前正在执行的处理程序时传递给事件方法的可选数据对象</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.isDefaultPrevented/" class="tooltip">event.isDefaultPrevented()<em class="tooltiptext">返回是否曾在此事件对象上调用过 event.preventDefault()</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.isImmediatePropagationStopped/" class="tooltip">event.isImmediatePropagationStopped()<em class="tooltiptext">返回是否曾在此事件对象上调用过 event.stopImmediatePropagation()</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.isPropagationStopped/" class="tooltip">event.isPropagationStopped()<em class="tooltiptext">返回是否曾在此事件对象上调用过 event.stopPropagation()</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.metaKey/" class="tooltip">event.metaKey<em class="tooltiptext">指示事件触发时是否按下了 META 键</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.namespace/" class="tooltip">event.namespace<em class="tooltiptext">触发事件时指定的命名空间</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.pageX/" class="tooltip">event.pageX<em class="tooltiptext">鼠标相对于文档左边缘的位置</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.pageY/" class="tooltip">event.pageY<em class="tooltiptext">鼠标位置相对于文档的上边缘</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.preventDefault/" class="tooltip">event.preventDefault()<em class="tooltiptext">如果调用该方法,则不会触发事件的默认动作</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.relatedTarget/" class="tooltip">event.relatedTarget<em class="tooltiptext">事件中涉及的其他 DOM 元素(如果有)</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.result/" class="tooltip">event.result<em class="tooltiptext">由此事件触发的事件处理程序返回的最后一个值,除非该值未定义</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.stopImmediatePropagation/" class="tooltip">event.stopImmediatePropagation()<em class="tooltiptext">保持其余的处理程序不被执行,并防止事件在 DOM 树中向上冒泡</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.stopPropagation/" class="tooltip">event.stopPropagation()<em class="tooltiptext">防止事件在 DOM 树中向上冒泡,从而防止任何父处理程序收到事件通知</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.target/" class="tooltip">event.target<em class="tooltiptext">发起事件的 DOM 元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.timeStamp/" class="tooltip">event.timeStamp<em class="tooltiptext">浏览器创建事件的时间与 1970 年 1 月 1 日之间的毫秒差</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.type/" class="tooltip">event.type<em class="tooltiptext">描述事件的性质</em></a></li>
|
||
<li><a href="https://api.jquery.com/event.which/" class="tooltip">event.which<em class="tooltiptext">对于键或鼠标事件,此属性指示按下的特定键或按钮</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="文档加载"><a aria-hidden="true" tabindex="-1" href="#文档加载"><span class="icon icon-link"></span></a>文档加载</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/load-event/" class="tooltip">.load()<em class="tooltiptext">将事件处理程序绑定到加载 JavaScript 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/ready/" class="tooltip">.ready()<em class="tooltiptext">指定在 DOM 完全加载时执行的函数</em></a></li>
|
||
<li><a href="https://api.jquery.com/unload/" class="tooltip">.unload()<em class="tooltiptext">将事件处理程序绑定到卸载 JavaScript 事件</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="事件处理程序附件"><a aria-hidden="true" tabindex="-1" href="#事件处理程序附件"><span class="icon icon-link"></span></a>事件处理程序附件</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/bind/" class="tooltip">.bind()<em class="tooltiptext">将处理程序附加到元素的事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/delegate/" class="tooltip">.delegate()<em class="tooltiptext">基于一组特定的根元素,将处理程序附加到现在或将来与选择器匹配的所有元素的一个或多个事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/die/" class="tooltip">.die()<em class="tooltiptext">从元素中删除先前使用 .live() 附加的事件处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/live/" class="tooltip">.live()<em class="tooltiptext">现在和将来为所有匹配当前选择器的元素附加一个事件处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/off/" class="tooltip">.off()<em class="tooltiptext">删除事件处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/on/" class="tooltip">.on()<em class="tooltiptext">将一个或多个事件的事件处理函数附加到所选元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/one/" class="tooltip">.one()<em class="tooltiptext">将处理程序附加到元素的事件。 每个事件类型的每个元素最多执行一次处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/trigger/" class="tooltip">.trigger()<em class="tooltiptext">执行附加到给定事件类型的匹配元素的所有处理程序和行为</em></a></li>
|
||
<li><a href="https://api.jquery.com/triggerHandler/" class="tooltip">.triggerHandler()<em class="tooltiptext">执行附加到事件元素的所有处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/unbind/" class="tooltip">.unbind()<em class="tooltiptext">从元素中删除先前附加的事件处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/undelegate/" class="tooltip">.undelegate()<em class="tooltiptext">根据一组特定的根元素,从与当前选择器匹配的所有元素的事件中删除处理程序</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="形式事件"><a aria-hidden="true" tabindex="-1" href="#形式事件"><span class="icon icon-link"></span></a>形式事件</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/blur/" class="tooltip">.blur()<em class="tooltiptext">将事件处理程序绑定到 blur JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/change/" class="tooltip">.change()<em class="tooltiptext">将事件处理程序绑定到更改 JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/focus/" class="tooltip">.focus()<em class="tooltiptext">将事件处理程序绑定到焦点 JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/focusin/" class="tooltip">.focusin()<em class="tooltiptext">将事件处理程序绑定到 focusin 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/focusout/" class="tooltip">.focusout()<em class="tooltiptext">将事件处理程序绑定到 focusout JavaScript 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/select/" class="tooltip">.select()<em class="tooltiptext">将事件处理程序绑定到 select JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/submit/" class="tooltip">.submit()<em class="tooltiptext">将事件处理程序绑定到提交 JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="键盘事件"><a aria-hidden="true" tabindex="-1" href="#键盘事件"><span class="icon icon-link"></span></a>键盘事件</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/keydown/" class="tooltip">.keydown()<em class="tooltiptext">将事件处理程序绑定到 keydown JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/keypress/" class="tooltip">.keypress()<em class="tooltiptext">将事件处理程序绑定到按键 JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/keyup/" class="tooltip">.keyup()<em class="tooltiptext">将事件处理程序绑定到 keyup JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="鼠标事件"><a aria-hidden="true" tabindex="-1" href="#鼠标事件"><span class="icon icon-link"></span></a>鼠标事件</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/click/" class="tooltip">.click()<em class="tooltiptext">将事件处理程序绑定到 click JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/contextmenu/" class="tooltip">.contextMenu()<em class="tooltiptext">将事件处理程序绑定到 contextmenu JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/dblclick/" class="tooltip">.dblclick()<em class="tooltiptext">将事件处理程序绑定到 dblclick JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/hover/" class="tooltip">.hover()<em class="tooltiptext">将两个处理程序绑定到匹配的元素,当鼠标指针进入和离开元素时执行</em></a></li>
|
||
<li><a href="https://api.jquery.com/mousedown/" class="tooltip">.mousedown()<em class="tooltiptext">将事件处理程序绑定到 mousedown JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/mouseenter/" class="tooltip">.mouseenter()<em class="tooltiptext">绑定要在鼠标进入元素时触发的事件处理程序,或在元素上触发该处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/mouseleave/" class="tooltip">.mouseleave()<em class="tooltiptext">绑定要在鼠标离开元素时触发的事件处理程序,或在元素上触发该处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/mousemove/" class="tooltip">.mousemove()<em class="tooltiptext">将事件处理程序绑定到 mousemove JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/mouseout/" class="tooltip">.mouseout()<em class="tooltiptext">将事件处理程序绑定到 mouseout JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/mouseover/" class="tooltip">.mouseover()<em class="tooltiptext">将事件处理程序绑定到 mouseover JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/mouseup/" class="tooltip">.mouseup()<em class="tooltiptext">将事件处理程序绑定到 mouseup JavaScript 事件,或在元素上触发该事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/toggle-event/" class="tooltip">.toggle()<em class="tooltiptext">将两个或多个处理程序绑定到匹配的元素,以在交替单击时执行</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-effects"><a aria-hidden="true" tabindex="-1" href="#jquery-effects"><span class="icon icon-link"></span></a>jQuery Effects</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="例子-3"><a aria-hidden="true" tabindex="-1" href="#例子-3"><span class="icon icon-link"></span></a>例子</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-2-->
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu-button'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token comment">// $('#menu').fadeIn(400, 'swing')</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">fadeIn</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
<h4 id="淡出效果"><a aria-hidden="true" tabindex="-1" href="#淡出效果"><span class="icon icon-link"></span></a>淡出效果</h4>
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu-button'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token comment">// $('#menu').fadeOut(400, 'swing')</span>
|
||
</span><span class="code-line"> <span class="token function">$</span><span class="token punctuation">(</span><span class="token string">'#menu'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">fadeOut</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="基本-1"><a aria-hidden="true" tabindex="-1" href="#基本-1"><span class="icon icon-link"></span></a>基本</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/hide/" class="tooltip">.hide()<em class="tooltiptext">隐藏匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/show/" class="tooltip">.show()<em class="tooltiptext">显示匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/toggle/" class="tooltip">.toggle()<em class="tooltiptext">显示或隐藏匹配的元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="滑动"><a aria-hidden="true" tabindex="-1" href="#滑动"><span class="icon icon-link"></span></a>滑动</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/slideDown/" class="tooltip">.slideDown()<em class="tooltiptext">以滑动方式显示匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/slideToggle/" class="tooltip">.slideToggle()<em class="tooltiptext">通过滑动显示或隐藏匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/slideUp/" class="tooltip">.slideUp()<em class="tooltiptext">通过滑动隐藏匹配的元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="自定义"><a aria-hidden="true" tabindex="-1" href="#自定义"><span class="icon icon-link"></span></a>自定义</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/animate/" class="tooltip">.animate()<em class="tooltiptext">执行一组 CSS 属性的自定义动画</em></a></li>
|
||
<li><a href="https://api.jquery.com/clearQueue/" class="tooltip">.clearQueue()<em class="tooltiptext">从队列中删除所有尚未运行的项目</em></a></li>
|
||
<li><a href="https://api.jquery.com/delay/" class="tooltip">.delay()<em class="tooltiptext">设置一个计时器来延迟队列中后续项目的执行</em></a></li>
|
||
<li><a href="https://api.jquery.com/dequeue/" class="tooltip">.dequeue()<em class="tooltiptext">为匹配的元素执行队列上的下一个函数</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.dequeue/" class="tooltip">jQuery.dequeue()<em class="tooltiptext">为匹配的元素执行队列上的下一个函数</em></a></li>
|
||
<li><a href="https://api.jquery.com/finish/" class="tooltip">.finish()<em class="tooltiptext">停止当前运行的动画,移除所有排队的动画,并完成匹配元素的所有动画</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.fx.interval/" class="tooltip">jQuery.fx.interval<em class="tooltiptext">动画触发的速率(以毫秒为单位)</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.fx.off/" class="tooltip">jQuery.fx.off<em class="tooltiptext">全局禁用所有动画</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.speed/" class="tooltip">jQuery.speed<em class="tooltiptext">创建一个对象,其中包含一组准备用于自定义动画定义的属性</em></a></li>
|
||
<li><a href="https://api.jquery.com/queue/" class="tooltip">.queue()<em class="tooltiptext">显示要在匹配元素上执行的函数队列</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.queue/" class="tooltip">jQuery.queue()<em class="tooltiptext">显示要在匹配元素上执行的函数队列</em></a></li>
|
||
<li><a href="https://api.jquery.com/stop/" class="tooltip">.stop()<em class="tooltiptext">停止匹配元素上当前运行的动画</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="衰退"><a aria-hidden="true" tabindex="-1" href="#衰退"><span class="icon icon-link"></span></a>衰退</h3><div class="wrap-body">
|
||
<ul class="cols-3 style-none">
|
||
<li><a href="https://api.jquery.com/fadeIn/" class="tooltip">.fadeIn()<em class="tooltiptext">通过将匹配的元素淡化为不透明来显示它们</em></a></li>
|
||
<li><a href="https://api.jquery.com/fadeOut/" class="tooltip">.fadeOut()<em class="tooltiptext">通过将它们淡化为透明来隐藏匹配的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/fadeTo/" class="tooltip">.fadeTo()<em class="tooltiptext">调整匹配元素的不透明度</em></a></li>
|
||
<li><a href="https://api.jquery.com/fadeToggle/" class="tooltip">.fadeToggle()<em class="tooltiptext">通过设置不透明度动画来显示或隐藏匹配的元素</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-3 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="jquery-ajax"><a aria-hidden="true" tabindex="-1" href="#jquery-ajax"><span class="icon icon-link"></span></a>jQuery Ajax</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="examples-2"><a aria-hidden="true" tabindex="-1" href="#examples-2"><span class="icon icon-link"></span></a>Examples</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-2-->
|
||
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line">$<span class="token punctuation">.</span><span class="token method function property-access">ajax</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token literal-property property">url</span><span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">action</span><span class="token punctuation">,</span>
|
||
</span><span class="code-line"> <span class="token literal-property property">type</span><span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">method</span><span class="token punctuation">,</span>
|
||
</span><span class="code-line"> <span class="token literal-property property">data</span><span class="token operator">:</span> <span class="token function">$</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">serialize</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">done</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">server_data</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">"success"</span> <span class="token operator">+</span> server_data<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">fail</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">jqXHR<span class="token punctuation">,</span> status<span class="token punctuation">,</span> err</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
|
||
</span><span class="code-line"> <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">"fail"</span> <span class="token operator">+</span> err<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span><span class="code-line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
</span></code></pre>
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="全局-ajax-事件处理程序"><a aria-hidden="true" tabindex="-1" href="#全局-ajax-事件处理程序"><span class="icon icon-link"></span></a>全局 Ajax 事件处理程序</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/ajaxComplete/" class="tooltip">.ajaxComplete()<em class="tooltiptext">注册要在 Ajax 请求完成时调用的处理程序。 这是一个 AjaxEvent</em></a></li>
|
||
<li><a href="https://api.jquery.com/ajaxError/" class="tooltip">.ajaxError()<em class="tooltiptext">注册一个处理程序,当 Ajax 请求完成但出现错误时调用。 这是一个 Ajax 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/ajaxSend/" class="tooltip">.ajaxSend()<em class="tooltiptext">附加一个要在发送 Ajax 请求之前执行的函数。 这是一个 Ajax 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/ajaxStart/" class="tooltip">.ajaxStart()<em class="tooltiptext">注册一个处理程序,在第一个 Ajax 请求开始时调用。 这是一个 Ajax 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/ajaxStop/" class="tooltip">.ajaxStop()<em class="tooltiptext">注册一个处理程序,在所有 Ajax 请求完成时调用。 这是一个 Ajax 事件</em></a></li>
|
||
<li><a href="https://api.jquery.com/ajaxSuccess/" class="tooltip">.ajaxSuccess()<em class="tooltiptext">附加一个要在 Ajax 请求成功完成时执行的函数。 这是一个 Ajax 事件</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="辅助功能"><a aria-hidden="true" tabindex="-1" href="#辅助功能"><span class="icon icon-link"></span></a>辅助功能</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.param/" class="tooltip">jQuery.param()<em class="tooltiptext">创建适合在 URL 查询字符串或 Ajax 请求中使用的数组、普通对象或 jQuery 对象的序列化表示。 如果传递了 jQuery 对象,它应该包含具有名称/值属性的输入元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/serialize/" class="tooltip">.serialize()<em class="tooltiptext">将一组表单元素编码为字符串以供提交</em></a></li>
|
||
<li><a href="https://api.jquery.com/serializeArray/" class="tooltip">.serializeArray()<em class="tooltiptext">将一组表单元素编码为名称和值的数组</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="底层接口"><a aria-hidden="true" tabindex="-1" href="#底层接口"><span class="icon icon-link"></span></a>底层接口</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.ajax/" class="tooltip">jQuery.ajax()<em class="tooltiptext">执行异步 HTTP (Ajax) 请求</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.ajaxPrefilter/" class="tooltip">jQuery.prefilter()<em class="tooltiptext">在发送每个请求之前和 $.ajax() 处理它们之前处理自定义 Ajax 选项或修改现有选项</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.ajaxSetup/" class="tooltip">jQuery.ajaxSetup()<em class="tooltiptext">为将来的 Ajax 请求设置默认值。 不推荐使用它</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.ajaxTransport/" class="tooltip">jQuery.ajaxTransport()<em class="tooltiptext">创建一个对象来处理 Ajax 数据的实际传输</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="速记方法"><a aria-hidden="true" tabindex="-1" href="#速记方法"><span class="icon icon-link"></span></a>速记方法</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.get/" class="tooltip">jQuery.get()<em class="tooltiptext">使用 HTTP GET 请求从服务器加载数据</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.getJSON/" class="tooltip">jQuery.getJSON()<em class="tooltiptext">使用 GET HTTP 请求从服务器加载 JSON 编码的数据</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.getScript/" class="tooltip">jQuery.getScript()<em class="tooltiptext">使用 GET HTTP 请求从服务器加载 JavaScript 文件,然后执行它</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.post/" class="tooltip">jQuery.post()<em class="tooltiptext">使用 HTTP POST 请求将数据发送到服务器</em></a></li>
|
||
<li><a href="https://api.jquery.com/load/" class="tooltip">.load()<em class="tooltiptext">从服务器加载数据并将返回的 HTML 放入匹配的元素中</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="各种各样的"><a aria-hidden="true" tabindex="-1" href="#各种各样的"><span class="icon icon-link"></span></a>各种各样的</h2><div class="wrap-body">
|
||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="jquery-对象"><a aria-hidden="true" tabindex="-1" href="#jquery-对象"><span class="icon icon-link"></span></a>jQuery 对象</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery/" class="tooltip">jQuery()<em class="tooltiptext">接受包含 CSS 选择器的字符串,然后用于匹配一组元</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.noConflict/" class="tooltip">jQuery.noConflict()<em class="tooltiptext">放弃 jQuery 对 $ 变量的控</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.sub/" class="tooltip">jQuery.sub()<em class="tooltiptext">创建一个新的 jQuery 副本,可以在不影响原始 jQuery 对象的情况下修改其属性和方</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.holdReady/" class="tooltip">jQuery.holdReady()<em class="tooltiptext">持有或释放jQuery的就绪事件的执</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.when/" class="tooltip">jQuery.when()<em class="tooltiptext">提供一种基于零个或多个 Thenable 对象执行回调函数的方法,通常是表示异步事件的 Deferred 对</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="延迟对象"><a aria-hidden="true" tabindex="-1" href="#延迟对象"><span class="icon icon-link"></span></a>延迟对象</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-2-->
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.Deferred/" class="tooltip">jQuery.Deferred()<em class="tooltiptext">返回可链接实用程序对象的工厂函数,该对象具有将多个回调注册到回调队列、调用回调队列以及中继任何同步或异步函数的成功或失败状态的方法</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.always/" class="tooltip">deferred.always()<em class="tooltiptext">添加要在延迟对象被解析或拒绝时调用的处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.done/" class="tooltip">deferred.done()<em class="tooltiptext">添加要在解析延迟对象时调用的处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.fail/" class="tooltip">deferred.fail()<em class="tooltiptext">添加处理程序以在延迟对象被拒绝时调用</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.isRejected/" class="tooltip">deferred.isRejected()<em class="tooltiptext">判断一个 Deferred 对象是否被拒绝</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.isResolved/" class="tooltip">deferred.isResolved()<em class="tooltiptext">判断一个 Deferred 对象是否已经解析</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.notify/" class="tooltip">deferred.notify()<em class="tooltiptext">使用给定的 args 在 Deferred 对象上调用 progressCallbacks</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.notifyWith/" class="tooltip">deferred.notifyWith()<em class="tooltiptext">使用给定的上下文和参数调用 Deferred 对象的 progressCallbacks</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.pipe/" class="tooltip">deferred.pipe()<em class="tooltiptext">过滤和/或链接 Deferreds 的实用方法</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.progress/" class="tooltip">deferred.progress()<em class="tooltiptext">添加在 Deferred 对象生成进度通知时要调用的处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.promise/" class="tooltip">deferred.promise()<em class="tooltiptext">返回一个 Deferred 的 Promise 对象</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.reject/" class="tooltip">deferred.reject()<em class="tooltiptext">拒绝 Deferred 对象并使用给定的 args 调用任何 failCallbacks</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.rejectWith/" class="tooltip">deferred.rejectWith()<em class="tooltiptext">拒绝 Deferred 对象并使用给定的上下文和参数调用任何 failCallbacks</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.resolve/" class="tooltip">deferred.resolve()<em class="tooltiptext">解析一个 Deferred 对象并使用给定的 args 调用任何 doneCallbacks</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.resolveWith/" class="tooltip">deferred.resolveWith()<em class="tooltiptext">解析延迟对象并使用给定的上下文和参数调用任何 doneCallbacks</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.state/" class="tooltip">deferred.state()<em class="tooltiptext">确定 Deferred 对象的当前状态</em></a></li>
|
||
<li><a href="https://api.jquery.com/deferred.then/" class="tooltip">deferred.then()<em class="tooltiptext">添加要在延迟对象被解析、拒绝或仍在进行中时调用的处理程序</em></a></li>
|
||
<li><a href="https://api.jquery.com/promise/" class="tooltip">.promise()<em class="tooltiptext">返回一个 Promise 对象以观察绑定到集合的特定类型的所有操作(无论是否排队)何时完成</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist row-span-3"><div class="wrap-header h3wrap"><h3 id="公用事业"><a aria-hidden="true" tabindex="-1" href="#公用事业"><span class="icon icon-link"></span></a>公用事业</h3><div class="wrap-body">
|
||
<!--rehype:wrap-class=row-span-3-->
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.boxModel/" class="tooltip">jQuery.boxModel<em class="tooltiptext">说明用户浏览器中的当前页面是否正在使用 W3C CSS 盒模型呈现</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.browser/" class="tooltip">jQuery.browser<em class="tooltiptext">包含用户代理的标志,从 navigator.userAgent 读取。 此属性在 jQuery 1.9 中被删除,只能通过 jQuery.migrate 插件使用。 请尝试改用特征检测</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.contains/" class="tooltip">jQuery.contains()<em class="tooltiptext">检查一个 DOM 元素是否是另一个 DOM 元素的后代</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.each/" class="tooltip">jQuery.each()<em class="tooltiptext">通用迭代器函数,可用于无缝迭代对象和数组。 具有长度属性的数组和类似数组的对象(例如函数的参数对象)按数字索引迭代,从 0 到 length-1。 其他对象通过它们的命名属性迭代</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.extend/" class="tooltip">jQuery.extend()<em class="tooltiptext">将两个或多个对象的内容合并到第一个对象中</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.globalEval/" class="tooltip">jQuery.globalEval()<em class="tooltiptext">全局执行一些 JavaScript 代码</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.grep/" class="tooltip">jQuery.grep()<em class="tooltiptext">查找满足过滤功能的数组元素。 原数组不受影响</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.inArray/" class="tooltip">jQuery.inArray()<em class="tooltiptext">在数组中搜索指定值并返回其索引(如果未找到,则返回 -1)</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isArray/" class="tooltip">jQuery.isArray()<em class="tooltiptext">判断参数是否为数组</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isEmptyObject/" class="tooltip">jQuery.isEmptyObject()<em class="tooltiptext">检查对象是否为空(不包含可枚举属性)</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isFunction/" class="tooltip">jQuery.isFunction()<em class="tooltiptext">确定其参数是否可作为函数调用</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isNumeric/" class="tooltip">jQuery.isNumeric()<em class="tooltiptext">确定其参数是否表示 JavaScript 数字</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isPlainObject/" class="tooltip">jQuery.isPlainObject()<em class="tooltiptext">检查对象是否为普通对象</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isWindow/" class="tooltip">jQuery.isWindow()<em class="tooltiptext">判断参数是否为窗口</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.isXMLDoc/" class="tooltip">jQuery.isXMLDoc()<em class="tooltiptext">检查 DOM 节点是否在 XML 文档中(或者是 XML 文档)</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.makeArray/" class="tooltip">jQuery.makeArray()<em class="tooltiptext">将类数组对象转换为真正的 JavaScript 数组</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.map/" class="tooltip">jQuery.map()<em class="tooltiptext">将数组或对象中的所有项转换为新的项数组</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.merge/" class="tooltip">jQuery.merge()<em class="tooltiptext">将两个数组的内容合并到第一个数组中</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.noop/" class="tooltip">jQuery.noop()<em class="tooltiptext">空函数</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.now/" class="tooltip">jQuery.now()<em class="tooltiptext">返回代表当前时间的数字</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.parseHTML/" class="tooltip">jQuery.parseHTML()<em class="tooltiptext">将字符串解析为 DOM 节点数组</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.parseJSON/" class="tooltip">jQuery.parseJSON()<em class="tooltiptext">获取格式正确的 JSON 字符串并返回生成的 JavaScript 值</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.parseXML/" class="tooltip">jQuery.parseXML()<em class="tooltiptext">将字符串解析为 XML 文档</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.proxy/" class="tooltip">jQuery.proxy()<em class="tooltiptext">接受一个函数并返回一个总是有特定上下文的新函数</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.support/" class="tooltip">jQuery.support<em class="tooltiptext">表示存在不同浏览器功能或错误的属性集合。 用于 jQuery 的内部使用; 当内部不再需要特定属性以提高页面启动性能时,可能会删除它们。 对于您自己项目的功能检测需求,我们强烈建议使用外部库(例如 Modernizr),而不是依赖于 jQuery.support 中的属性</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.trim/" class="tooltip">jQuery.trim()<em class="tooltiptext">删除字符串开头和结尾的空格</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.type/" class="tooltip">jQuery.type()<em class="tooltiptext">确定对象的内部 JavaScript [[Class]]</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.unique/" class="tooltip">jQuery.unique()<em class="tooltiptext">对 DOM 元素数组进行适当的排序,并删除重复项。 请注意,这仅适用于 DOM 元素数组,不适用于字符串或数字</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.uniqueSort/" class="tooltip">jQuery.uniqueSort()<em class="tooltiptext">对 DOM 元素数组进行适当的排序,并删除重复项。 请注意,这仅适用于 DOM 元素数组,不适用于字符串或数字</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="dom-元素方法"><a aria-hidden="true" tabindex="-1" href="#dom-元素方法"><span class="icon icon-link"></span></a>DOM 元素方法</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/get/" class="tooltip">.get()<em class="tooltiptext">检索与 jQuery 对象匹配的元素之一</em></a></li>
|
||
<li><a href="https://api.jquery.com/index/" class="tooltip">.index()<em class="tooltiptext">从匹配的元素中搜索给定的元素</em></a></li>
|
||
<li><a href="https://api.jquery.com/size/" class="tooltip">.size()<em class="tooltiptext">返回 jQuery 对象中元素的数量</em></a></li>
|
||
<li><a href="https://api.jquery.com/toArray/" class="tooltip">.toArray()<em class="tooltiptext">检索 jQuery 集合中包含的所有元素,作为数组</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="内部结构"><a aria-hidden="true" tabindex="-1" href="#内部结构"><span class="icon icon-link"></span></a>内部结构</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jquery-2/" class="tooltip">.jquery<em class="tooltiptext">包含 jQuery 版本号的字符串</em></a></li>
|
||
<li><a href="https://api.jquery.com/context/" class="tooltip">.context<em class="tooltiptext">最初传递给 jQuery() 的 DOM 节点上下文; 如果未通过,则上下文可能是文档</em></a></li>
|
||
<li><a href="https://api.jquery.com/jQuery.error/" class="tooltip">jQuery.error()<em class="tooltiptext">获取一个字符串并抛出包含它的异常</em></a></li>
|
||
<li><a href="https://api.jquery.com/length/" class="tooltip">.length<em class="tooltiptext">jQuery 对象中元素的数量</em></a></li>
|
||
<li><a href="https://api.jquery.com/pushStack/" class="tooltip">.pushStack()<em class="tooltiptext">将一组 DOM 元素添加到 jQuery 堆栈中</em></a></li>
|
||
<li><a href="https://api.jquery.com/selector/" class="tooltip">.selector<em class="tooltiptext">代表选择器的选择器在创建原始集合时传递给 jQuery(),如果有的话</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="回调对象"><a aria-hidden="true" tabindex="-1" href="#回调对象"><span class="icon icon-link"></span></a>回调对象</h3><div class="wrap-body">
|
||
<ul class="cols-2 style-none">
|
||
<li><a href="https://api.jquery.com/jQuery.Callbacks/" class="tooltip">jQuery.Callbacks()<em class="tooltiptext">一个多用途回调列表对象,提供了一种管理回调列表的强大方法</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.add/" class="tooltip">callbacks.add()<em class="tooltiptext">将回调或回调集合添加到回调列表</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.disable/" class="tooltip">callbacks.disable()<em class="tooltiptext">禁止回调列表做更多的事情</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.disabled/" class="tooltip">callbacks.disabled()<em class="tooltiptext">确定回调列表是否已被禁用</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.empty/" class="tooltip">callbacks.empty()<em class="tooltiptext">从列表中删除所有回调</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.fire/" class="tooltip">callbacks.fire()<em class="tooltiptext">使用给定参数调用所有回调</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.fired/" class="tooltip">callbacks.fired()<em class="tooltiptext">确定回调是否已至少被调用一次</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.fireWith/" class="tooltip">callbacks.fireWith()<em class="tooltiptext">使用给定的上下文和参数调用列表中的所有回调</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.has/" class="tooltip">callbacks.has()<em class="tooltiptext">确定列表是否附加了任何回调。如果回调作为参数提供,请确定它是否在列表中</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.lock/" class="tooltip">callbacks.lock()<em class="tooltiptext">将回调列表锁定在其当前状态</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.locked/" class="tooltip">callbacks.locked()<em class="tooltiptext">判断回调列表是否被锁定</em></a></li>
|
||
<li><a href="https://api.jquery.com/callbacks.remove/" class="tooltip">callbacks.remove()<em class="tooltiptext">从回调列表中删除回调或回调集合</em></a></li>
|
||
</ul>
|
||
<!--rehype:className=cols-2 style-none-->
|
||
</div></div></div></div></div></div><script src="https://giscus.app/client.js" data-repo="jaywcjlove/reference" data-repo-id="R_kgDOID2-Mw" data-category="Q&A" data-category-id="DIC_kwDOID2-M84CS5wo" data-mapping="pathname" data-strict="0" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="dark" data-lang="zh-CN" crossorigin="anonymous" async></script><div class="giscus"></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 <a href="https://wangchujiang.com/#/app" target="_blank">Kenny Wang</a>.</footer></footer><script src="../data.js?v=1.5.5" defer></script><script src="../js/fuse.min.js?v=1.5.5" defer></script><script src="../js/main.js?v=1.5.5" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
|
||
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
|
||
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
|
||
</html>
|