1/* 2 * jQuery HoverPulse Plugin by M. Alsup 3 * Examples and docs at: http://malsup.com/jquery/hoverpulse/ 4 * Dual licensed under the MIT and GPL 5 * Requires: jQuery v1.2.6 or later 6 * @version: 1.01 26-FEB-2009 7 */ 8 9(function ($) { 10 11 $.fn.hoverpulse = function (options) { 12 // in 1.3+ we can fix mistakes with the ready state 13 if (this.length == 0) { 14 if (!$.isReady && this.selector) { 15 var s = this.selector, c = this.context; 16 $(function () { 17 $(s, c).hoverpulse(options); 18 }); 19 } 20 return this; 21 } 22 23 var opts = $.extend({}, $.fn.hoverpulse.defaults, options); 24 25 // parent must be relatively positioned 26 this.parent().css({ position: 'relative' }); 27 // pulsing element must be absolutely positioned 28 this.css({ position: 'absolute', top: 25, left: 0 }); 29 30 this.each(function () { 31 var $this = $(this); 32 var w = $this.width(), h = $this.height(); 33 $this.data('hoverpulse.size', { w: parseInt(w), h: parseInt(h) }); 34 }); 35 36 // bind hover event for behavior 37 return this.hover( 38 // hover over 39 function () { 40 var $this = $(this); 41 $this.parent().css('z-index', opts.zIndexActive); 42 43 var size = $this.data('hoverpulse.size'); 44 var w = size.w, h = size.h; 45 $this.stop().animate({ 46 top: ('-100px'), 47 left: ('-100px'), 48 height: (h + 2 * opts.size) + 'px', 49 width: (w + 2 * opts.size) + 'px' 50 }, opts.speed); 51 }, 52 // hover out 53 function () { 54 var $this = $(this); 55 var size = $this.data('hoverpulse.size'); 56 var w = size.w, h = size.h; 57 58 $this.stop().animate({ 59 top: 25, 60 left: 0, 61 height: (h + 'px'), 62 width: (w + 'px') 63 }, opts.speed, function () { 64 $this.parent().css('z-index', opts.zIndexNormal); 65 }); 66 } 67 ); 68 }; 69 70 $.fn.hoverpulse.defaults = { 71 size: 20, 72 speed: 200, 73 zIndexActive: 100, 74 zIndexNormal: 1 75 }; 76 77})(jQuery);
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.