1/** 2 * jQuery.rollover 3 * 4 * @version 1.0.4 5 * @author Hiroshi Hoaki <[email protected]> 6 * @copyright 2010-2013 Hiroshi Hoaki 7 * @license The MIT License 8 * @link http://rewish.jp/blog/releases/jquery_rollover 9 * 10 * Usage: 11 * jQuery(document).ready(function($) { 12 * // <img> 13 * $('#nav a img').rollover(); 14 * 15 * // <input type="img"> 16 * $('form input:img').rollover(); 17 * 18 * // set suffix 19 * $('#nav a img').rollover('_over'); 20 * }); 21 */ 22jQuery.fn.rollover = function(suffix) { 23 suffix = suffix || '_on'; 24 var check = new RegExp(suffix + '\\.\\w+$'); 25 return this.each(function() { 26 var img = jQuery(this); 27 var src = img.attr('src'); 28 if (check.test(src)) return; 29 var _on = src.replace(/\.\w+$/, suffix + '$&'); 30 jQuery('<img>').attr('src', _on); 31 img.hover( 32 function() { img.attr('src', _on); }, 33 function() { img.attr('src', src); } 34 ); 35 }); 36};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.