今回もイベントの処理に関する部分の解説になります。$(document).ready()を実装している部分が出てきますが,
それでは,
jQuery. fn. bind()
2183: jQuery.fn.extend({
2184: bind: function( type, data, fn ) {
2185: return type == "unload" ? this.one(type, data, fn) : this.each(function(){
2186: jQuery.event.add( this, type, fn || data, fn && data );
2187: });
2188: },
2189:
jQuery.
2185行目で,
jQuery. fn. one()
2190: one: function( type, data, fn ) {
2191: return this.each(function(){
2192: jQuery.event.add( this, type, function(event) {
2193: jQuery(this).unbind(event);
2194: return (fn || data).apply( this, arguments);
2195: }, fn && data);
2196: });
2197: },
2198:
jQuery.
2192行目でjQuery.
jQuery. fn. unbind()
2199: unbind: function( type, fn ) {
2200: return this.each(function(){
2201: jQuery.event.remove( this, type, fn );
2202: });
2203: },
2204:
jQuery.
jQuery. fn. trigger()
2205: trigger: function( type, data, fn ) {
2206: return this.each(function(){
2207: jQuery.event.trigger( type, data, this, true, fn );
2208: });
2209: },
2210:
jQuery.
jQuery. fn. triggerHandler()
2211: triggerHandler: function( type, data, fn ) {
2212: if ( this[0] )
2213: return jQuery.event.trigger( type, data, this[0], false, fn );
2214: return undefined;
2215: },
2216:
jQuery.