1/* 2 Mosaic - Sliding Boxes and Captions jQuery Plugin 3 Version 1.0.1 4 www.buildinternet.com/project/mosaic 5 6 By Sam Dunn / One Mighty Roar (www.onemightyroar.com) 7 Released under MIT License / GPL License 8*/ 9 10(function($){ 11 12 if(!$.omr){ 13 $.omr = new Object(); 14 }; 15 16 $.omr.mosaic = function(el, options){ 17 18 var base = this; 19 20 // Access to jQuery and DOM versions of element 21 base.$el = $(el); 22 base.el = el; 23 24 // Add a reverse reference to the DOM object 25 base.$el.data("omr.mosaic", base); 26 27 base.init = function(){ 28 base.options = $.extend({},$.omr.mosaic.defaultOptions, options); 29 30 base.load_box(); 31 }; 32 33 // Preload Images 34 base.load_box = function(){ 35 // Hide until window loaded, then fade in 36 if (base.options.preload){ 37 $(base.options.backdrop, base.el).hide(); 38 $(base.options.overlay, base.el).hide(); 39 40 $(window).load(function(){ 41 // IE transparency fade fix 42 if(base.options.options.animation == 'fade' && $(base.options.overlay, base.el).css('opacity') == 0 ) $(base.options.overlay, base.el).css('filter', 'alpha(opacity=0)'); 43 44 $(base.options.overlay, base.el).fadeIn(200, function(){ 45 $(base.options.backdrop, base.el).fadeIn(200); 46 }); 47 48 base.allow_hover(); 49 }); 50 }else{ 51 $(base.options.backdrop, base.el).show(); 52 $(base.options.overlay , base.el).show(); 53 base.allow_hover(); 54 } 55 }; 56 57 // Initialize hover animations 58 base.allow_hover = function(){ 59 // Select animation 60 switch(base.options.animation){ 61 62 // Handle fade animations 63 case 'fade': 64 $(base.el).hover(function () { 65 $(base.options.overlay, base.el).stop().fadeTo(base.options.speed, base.options.opacity); 66 },function () { 67 $(base.options.overlay, base.el).stop().fadeTo(base.options.speed, 0); 68 }); 69 70 break; 71 72 // Handle slide animations 73 case 'slide': 74 // Grab default overlay x,y position 75 startX = $(base.options.overlay, base.el).css(base.options.anchor_x) != 'auto' ? $(base.options.overlay, base.el).css(base.options.anchor_x) : '0px'; 76 startY = $(base.options.overlay, base.el).css(base.options.anchor_y) != 'auto' ? $(base.options.overlay, base.el).css(base.options.anchor_y) : '0px';; 77 78 var hoverState = {}; 79 hoverState[base.options.anchor_x] = base.options.hover_x; 80 hoverState[base.options.anchor_y] = base.options.hover_y; 81 82 var endState = {}; 83 endState[base.options.anchor_x] = startX; 84 endState[base.options.anchor_y] = startY; 85 86 $(base.el).hover(function () { 87 $(base.options.overlay, base.el).stop().animate(hoverState, base.options.speed); 88 },function () { 89 $(base.options.overlay, base.el).stop().animate(endState, base.options.speed); 90 }); 91 92 break; 93 }; 94 }; 95 96 // Make it go! 97 base.init(); 98 }; 99 100 $.omr.mosaic.defaultOptions = { 101 animation : 'fade', 102 speed : 150, 103 opacity : 1, 104 preload : 0, 105 anchor_x : 'left', 106 anchor_y : 'bottom', 107 hover_x : '0px', 108 hover_y : '0px', 109 overlay : '.mosaic-overlay', //Mosaic overlay 110 backdrop : '.mosaic-backdrop' //Mosaic backdrop 111 }; 112 113 $.fn.mosaic = function(options){ 114 return this.each(function(){ 115 (new $.omr.mosaic(this, options)); 116 }); 117 }; 118 119})(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.