comparison test-data/res_files/js/jquery.opacityrollover.js @ 61:9185ca0a7b43 draft

Updated package according to recommendations.
author pierre.pouchin
date Wed, 16 Jan 2019 08:18:13 -0500
parents
children
comparison
equal deleted inserted replaced
60:9645d995fb3c 61:9185ca0a7b43
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);