comparison bin/js/jquery.opacityrollover.js @ 0:198009598544 draft

Uploaded
author romaingred
date Wed, 11 Oct 2017 09:57:58 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:198009598544
1 /**
2 * jQuery Opacity Rollover plugin
3 *
4 * Copyright (c) 2009 Trent Foley (http://trentacular.com)
5 * Licensed under the MIT License:
6 * http://www.opensource.org/licenses/mit-license.php
7 */
8 ;(function($) {
9 var defaults = {
10 mouseOutOpacity: 0.67,
11 mouseOverOpacity: 1.0,
12 fadeSpeed: 'fast',
13 exemptionSelector: '.selected'
14 };
15
16 $.fn.opacityrollover = function(settings) {
17 // Initialize the effect
18 $.extend(this, defaults, settings);
19
20 var config = this;
21
22 function fadeTo(element, opacity) {
23 var $target = $(element);
24
25 if (config.exemptionSelector)
26 $target = $target.not(config.exemptionSelector);
27
28 $target.fadeTo(config.fadeSpeed, opacity);
29 }
30
31 this.css('opacity', this.mouseOutOpacity)
32 .hover(
33 function () {
34 fadeTo(this, config.mouseOverOpacity);
35 },
36 function () {
37 fadeTo(this, config.mouseOutOpacity);
38 });
39
40 return this;
41 };
42 })(jQuery);