JAVASCRIPT   21

alias.js

Guest on 24th May 2021 03:55:15 AM

  1. define( [
  2.       "../core",
  3.  
  4.       "../event",
  5.       "./trigger"
  6. ], function( jQuery ) {
  7.  
  8. "use strict";
  9.  
  10. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  11.       "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  12.       "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13.       function( i, name ) {
  14.  
  15.       // Handle event binding
  16.       jQuery.fn[ name ] = function( data, fn ) {
  17.             return arguments.length > 0 ?
  18.                   this.on( name, null, data, fn ) :
  19.                   this.trigger( name );
  20.       };
  21. } );
  22.  
  23. jQuery.fn.extend( {
  24.       hover: function( fnOver, fnOut ) {
  25.             return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  26.       }
  27. } );
  28.  
  29. } );

Raw Paste


Login or Register to edit or fork this paste. It's free.