Sha256: f43390dc52407f11565a41757bd4eeaac9986626398c0c95931a47cb903218bf
Contents?: true
Size: 1.06 KB
Versions: 253
Compression:
Stored size: 1.06 KB
Contents
/** * swapImage - jQuery plugin for swapping image * * Copyright (c) 2008 tszming (tszming@gmail.com) * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ jQuery.swapImage=function(i,preload,repeat,swapInEvent,swapOutEvent){jQuery.swapImage.preload=function(){var img=new Image();img.src=jQuery(this).metadata().src};jQuery.swapImage.swap=function(){var data=jQuery(this).metadata();var tmp=data.src;data.src=this.src;this.src=tmp};jQuery(document).ready(function(){if(typeof preload=="undefined")preload=true;if(typeof repeat=="undefined")repeat=true;if(typeof swapInEvent=="undefined"&&typeof swapInEvent=="undefined"){swapInEvent="mouseenter";swapOutEvent="mouseleave"}if(repeat){if(typeof swapOutEvent!="undefined"){jQuery(i).bind(swapInEvent,jQuery.swapImage.swap).bind(swapOutEvent,jQuery.swapImage.swap)}else{jQuery(i).bind(swapInEvent,jQuery.swapImage.swap)}}else{jQuery(i).one(swapInEvent,jQuery.swapImage.swap)}if(preload){jQuery(i).each(jQuery.swapImage.preload)}})};
Version data entries
253 entries across 207 versions & 15 rubygems