zoukankan      html  css  js  c++  java
  • jquery插件学习(四)

    继续;加油哈,坚持,fighting :)

    如果你明白了前面讲的使用jquery.fn对象属性的方法创建jquery对象的方法,那么使用extend()方法创建jquery对象就比较容易理解了。理解了吗,一定要仔细揣摩,仔细研究。我也是再慢慢的学习,慢慢的领悟。

    针对上面的示例,我们可以调用jquery.fn.extend()方法来创建jquery对象方法。具体代码如下》

    jQuery.fn.extend({
        test : function(){
            return this.each(function(){
                alert(this.nodeName);
            })    
        }    
    });

    调用跟上面一样哦

    $('body *').click(function(){
            $(this).test().html(this.nodeName).hide(1000);    
    });    

    到这里,已经介绍了写jquery插件的两种方法,jquery.extend() 和jquery.fn.extend(),你学会了吗。

  • 相关阅读:
    配置文件管理
    Nacos学习
    dockerCompose学习
    Dockerfile
    vue生命周期
    github使用
    推荐系统
    js笔记17
    js笔记16
    js笔记15
  • 原文地址:https://www.cnblogs.com/jine/p/2623142.html
Copyright © 2011-2022 走看看