jQuery 1.0.2

2020-05-23 06:10:44易采站长站整理

};
jQuery.init();
jQuery.fn.extend({
    // We’re overriding the old toggle function, so
    // remember it for later
    _toggle: jQuery.fn.toggle,
    toggle: function(a,b) {
        // If two functions are passed in, we’re
        // toggling on a click
        return a && b && a.constructor == Function && b.constructor == Function ? this.click(function(e){
            // Figure out which function to execute
            this.last = this.last == a ? b : a;
            // Make sure that clicks stop
            e.preventDefault();
            // and execute the function
            return this.last.apply( this, [e] ) || false;
        }) :
        // Otherwise, execute the old toggle function
        this._toggle.apply( this, arguments );
    },
    hover: function(f,g) {
        // A private function for haandling mouse ‘hovering’
        function handleHover(e) {
            // Check if mouse(over|out) are still within the same parent element
            var p = (e.type == “mouseover” ? e.fromElement : e.toElement) || e.relatedTarget;
            // Traverse up the tree
            while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; };
            // If we actually just moused on to a sub-element, ignore it