wfquery
Version:
like jQuery but just for new browser
39 lines (35 loc) • 1.66 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo/layout.html</title>
<script src="../wfQuery.js?_t=1516462775018"></script>
<!--
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script>wfQuery = jQuery</script>
-->
<style>
pre.code{background: #d2d2d2;padding: 4px;}
</style>
</head>
<body>
<a href="../index.html">返回首页</a>
<h2>事件绑定支持</h2>
<ul id="list">
<li>只提供一个方法 on 进行事件绑定</li>
<li>trigger 触发自定义以及浏览器原生事件</li>
<li>支持代理绑定事件, 【同jQuery】</li>
<li><strong>代理绑定事件增加了 多一个参数 类型为function, 当点击到代理标签内且不符合target标准时触发</strong></li>
<li>off 删除事件只支持按照事件类型全部删除 <em class="new-in">new-in-test</em></li>
</ul>
<script class="code">
$('#list li').on('click',function(){
$(this).append( '<em class="new-in"> 我是新来的,</em>' );
});
$('#list').on('click','.new-in',function(e){
alert( '不管是不是延迟添加的dom, 都可以用代理绑定事件' );
});
</script>
<a href="https://github.com/shy2850/wfQuery.git" target="_"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
</body>
</html>