com web/php: Fading of poor user comments now uses only one event instead of one per poor comment.: js/common.js

From: Date: Thu, 05 Dec 2013 22:41:44 +0000
Subject: com web/php: Fading of poor user comments now uses only one event instead of one per poor comment.: js/common.js
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-17418@lists.php.net to get a copy of this message
Commit: e3b34780d25c994e493402d3a71bfc767d380247 Author: Levi Morrison <levim@php.net> Thu, 5 Dec 2013 15:41:44 -0700 Parents: 39b739ac0e6dd3f4f0ce065bd63e90d067494540 Branches: master Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=e3b34780d25c994e493402d3a71bfc767d380247 Log: Fading of poor user comments now uses only one event instead of one per poor comment. Changed paths: M js/common.js Diff: diff --git a/js/common.js b/js/common.js index cb53703..387a483 100755 --- a/js/common.js +++ b/js/common.js @@ -285,16 +285,20 @@ $(document).ready(function() { return (value - this.domain.min) * multiplier + this.range.min; }; }; - $(usernotes).find('.note .tally:contains("-")').each(function() { - var id = this.id.replace('V', ''); - var v = mapper.normalize(this.innerHTML.toInt()); - var onNoteOver = function() { - $(this).fadeTo('fast', 1); - }; - var onNoteOut = function() { - $(this).fadeTo('normal', v); - }; - $('#' + id).css('opacity', v).hover(onNoteOver, onNoteOut); + $(usernotes).on('mouseenter mouseleave', '.note', function(event) { + var opacity = 1; + var $note = $(this); + if (event.type === 'mouseleave' && $note.data('opacity') !== undefined) { + opacity = $note.data('opacity'); + } + $note.fadeTo('fast', opacity); + }).find('.note').each(function() { + var $note = $(this); + $note.find('.tally:contains("-")').each(function(){ + var id = this.id.replace('V', ''); + var v = mapper.normalize(this.innerHTML.toInt()); + $note.fadeTo(0, v).data("opacity", v); + }); }); } /* }}} */

« previous php.webmaster (#17418) next »