jquery bind()命名空间代码实例

快乐打工仔 分类:实例代码

关于bind()和命名空间可以参阅以下两篇文章。

下面只是分享一个关于bind()命名空间应用的代码实例:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
  $("p").bind("click.background",function(){
    $(this).css("background","#ccc")
  })
  $("p").bind("click.font",function(){
    $(this).css("font-weight","bold")
  })
  $("p").unbind("click.font");
})
</script>
</head>
<body>
<p>前端教程网</p>
</body>
</html>

jquery bind()命名空间代码实例,这样的场景在实际项目中还是用的比较多的,关于jquery bind()命名空间代码实例就介绍到这了。

jquery bind()命名空间代码实例属于前端实例代码,有关更多实例代码大家可以查看

回复

我来回复
  • 暂无回复内容