Mercurial > repos > romaingred > pirna_pipeline
diff bin/js/jquery.opacityrollover.js @ 0:198009598544 draft
Uploaded
author | romaingred |
---|---|
date | Wed, 11 Oct 2017 09:57:58 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/js/jquery.opacityrollover.js Wed Oct 11 09:57:58 2017 -0400 @@ -0,0 +1,42 @@ +/** + * jQuery Opacity Rollover plugin + * + * Copyright (c) 2009 Trent Foley (http://trentacular.com) + * Licensed under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + */ +;(function($) { + var defaults = { + mouseOutOpacity: 0.67, + mouseOverOpacity: 1.0, + fadeSpeed: 'fast', + exemptionSelector: '.selected' + }; + + $.fn.opacityrollover = function(settings) { + // Initialize the effect + $.extend(this, defaults, settings); + + var config = this; + + function fadeTo(element, opacity) { + var $target = $(element); + + if (config.exemptionSelector) + $target = $target.not(config.exemptionSelector); + + $target.fadeTo(config.fadeSpeed, opacity); + } + + this.css('opacity', this.mouseOutOpacity) + .hover( + function () { + fadeTo(this, config.mouseOverOpacity); + }, + function () { + fadeTo(this, config.mouseOutOpacity); + }); + + return this; + }; +})(jQuery);