We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在jquery中, $ 变量是 jQuery 变量的简写
$
jQuery
jQuery === $ // true
事件的触发会有三个阶段,捕获,处于目标,冒泡
捕获阶段不会触发事件,事件会在处于目标阶段开始,逐渐冒泡触发
// 使用通用事件名作为函数 $('button').click(function(event){ // event 为事件对象 }) // 使用 bind 或者on $('button').bind('click', function(event){}) $('button').on('click', function(event){}) // 使用 on 事件委托 $('body').on('click', 'button', function(event){})
事件处理函数有一参数 event,在该函数中调用event.stopPropagation() 可阻止事件冒泡
$('button').click(function(event){ event.stopPropagation() })
$.fn是指jquery的命名空间,加上fn上的方法及属性,会对jquery实例每一个有效。
扩展为了不污染全局变量,应使用立即执行函数包裹
(function($, document, window){ $.fn.myExtention = function(){ // extendsion code // ... } })(jQuery, document, window)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
jQuery && $
在jquery中,
$
变量是jQuery
变量的简写$ 方法
事件
事件的触发会有三个阶段,捕获,处于目标,冒泡
捕获阶段不会触发事件,事件会在处于目标阶段开始,逐渐冒泡触发
事件绑定
阻止冒泡
事件处理函数有一参数 event,在该函数中调用event.stopPropagation() 可阻止事件冒泡
扩展
$.fn是指jquery的命名空间,加上fn上的方法及属性,会对jquery实例每一个有效。
扩展为了不污染全局变量,应使用立即执行函数包裹
The text was updated successfully, but these errors were encountered: