日期:2014-05-16  浏览次数:20329 次

关于jQuery工具中sub()函数的理解

<div class="menu">
     <div class="submenu"></div>
</div>



(function() {
    var myjQuery = jQuery.sub();
    myjQuery.fn.remove = function() {
        this.trigger("remove");
        return jQuery.fn.remove.apply( this, arguments );
    };
    myjQuery(function($) {
        $(".menu").click(function() {
            $(this).find(".submenu").remove();
        });
        //这个绑定函数没触发,要怎么才能触发呢?
        $(document).bind("remove", function(e) {
            $(e.target).parent().hide();
        });
    });
})();


上面这个函数有点看不懂,多谢大家指教啦~
jquery 工具 function javascript

------解决方案--------------------
var myjQuery = jQuery.sub();
API:可创建一个新的jQuery副本,不影响原有的jQuery对像。
按api的说法相当于拷贝一份jQuery对象,也就是在这个对象是一个新对象,与jQuery/$没有关系

myjQuery(document).bind("remove", function(e) {
            $(e.target).parent().hide();
});
这样就可以成功了
------解决方案--------------------
find("id"),你把点去了试试
------解决方案--------------------
直接看api:
http://www.css88.com/jqapi-1.7/#p=jQuery.sub
------解决方案--------------------
没有使用的必要  基本用不到的功能

剩余的话全在 楼上贴的网址里面又写
我就不复制了