annotate bin/js/jquery.opacityrollover.js @ 17:8031792a6e2c draft

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