{"action":"created","issue":{"url":"https://api.github.com/repos/Liudongge/jQuery_Notes/issues/2","repository_url":"https://api.github.com/repos/Liudongge/jQuery_Notes","labels_url":"https://api.github.com/repos/Liudongge/jQuery_Notes/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/Liudongge/jQuery_Notes/issues/2/comments","events_url":"https://api.github.com/repos/Liudongge/jQuery_Notes/issues/2/events","html_url":"https://github.com/Liudongge/jQuery_Notes/issues/2","id":226224671,"number":2,"title":"JQuery中的事件和动画","user":{"login":"Liudongge","id":15403285,"avatar_url":"https://avatars3.githubusercontent.com/u/15403285?v=3","gravatar_id":"","url":"https://api.github.com/users/Liudongge","html_url":"https://github.com/Liudongge","followers_url":"https://api.github.com/users/Liudongge/followers","following_url":"https://api.github.com/users/Liudongge/following{/other_user}","gists_url":"https://api.github.com/users/Liudongge/gists{/gist_id}","starred_url":"https://api.github.com/users/Liudongge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Liudongge/subscriptions","organizations_url":"https://api.github.com/users/Liudongge/orgs","repos_url":"https://api.github.com/users/Liudongge/repos","events_url":"https://api.github.com/users/Liudongge/events{/privacy}","received_events_url":"https://api.github.com/users/Liudongge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-04T09:32:58Z","updated_at":"2017-05-05T09:58:47Z","closed_at":null,"body":"**JQuery中的事件**\r\n1. 加载DOM\r\n$(document).ready(function(){}) 简化为$(function(){}) 或者 $().ready(function(){})\r\n可多次调用，区别于window.onload()的一次调用。\r\n\r\n2. 事件绑定\r\nbind(type, [, data], fn);   简化为.click(), .mouseover(), .mouseout()等\r\n\r\n3. 合成事件\r\nhover(enter, leave)和toggle(fn1, fn2, ...fn).\r\nhover控制鼠标滑过事件，toggle模拟鼠标连续点击事件，另外也可切换元素的可见状态。\r\n\r\n4. 事件冒泡\r\nDOM多个层次有绑定事件，触发时事件按照DOM层次结构向上至顶端。\r\n为事件添加参数event，之后调用event.stopPropagation()方法停止冒泡事件，调用event.preventDefault()方法来阻止元素的默认行为。 可以使用return false来简写上面两个方法。\r\n\r\n5. 事件对象的属性\r\nevent.type()获取事件类型，event.target()获取触发事件的元素，event.pageX()和event.pageY()获取光标相对于页面的x,y坐标，event.which()获取鼠标按键或者键盘按键。其余略\r\n\r\n6. 移除事件\r\nunbind([type], [ , data]) 第一个参数是事件类型，第二个参数是要移除的函数，若无参，则移除所有。\r\n另外，对于只触发一次，使用后立即解除的事件，使用one()方法。使用方式同bind()一致。\r\n\r\n7. 模拟操作\r\ntrigger()\r\n\r\n8. 其他用法\r\n绑定多个事件类型\r\n添加事件命名空间，便于管理\r\n相同事件名称，不同命名空间执行方法"},"comment":{"url":"https://api.github.com/repos/Liudongge/jQuery_Notes/issues/comments/299426805","html_url":"https://github.com/Liudongge/jQuery_Notes/issues/2#issuecomment-299426805","issue_url":"https://api.github.com/repos/Liudongge/jQuery_Notes/issues/2","id":299426805,"user":{"login":"Liudongge","id":15403285,"avatar_url":"https://avatars3.githubusercontent.com/u/15403285?v=3","gravatar_id":"","url":"https://api.github.com/users/Liudongge","html_url":"https://github.com/Liudongge","followers_url":"https://api.github.com/users/Liudongge/followers","following_url":"https://api.github.com/users/Liudongge/following{/other_user}","gists_url":"https://api.github.com/users/Liudongge/gists{/gist_id}","starred_url":"https://api.github.com/users/Liudongge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Liudongge/subscriptions","organizations_url":"https://api.github.com/users/Liudongge/orgs","repos_url":"https://api.github.com/users/Liudongge/repos","events_url":"https://api.github.com/users/Liudongge/events{/privacy}","received_events_url":"https://api.github.com/users/Liudongge/received_events","type":"User","site_admin":false},"created_at":"2017-05-05T09:58:47Z","updated_at":"2017-05-05T09:58:47Z","body":"**其他动画方法**\r\n1. toggle(speed, [callback])　替代show()和hide()\r\n2. slideToggle(speed, [callback])  替代slideUp()和slideDown()\r\n3. fadeTo(speed, opacity, [callback]) 替代fadeIn()和fadeOut()"}}
{"actor":{"display_login":"Liudongge"}}