2011-01-13 8 views
0

Gallerifficで発生するアニメーションの蓄積を停止するためにstop()関数を使用する方法を理解しようとしています。サムネイル画像の上を素早く繰り返してマウスを動かすと起こります。私は単純なjqueryスクリプトで、アニメーション関数でstop()関数を使用することを知っていますが、ガレリフィックは非常に多くのコードを使用しています。Galleriffic 2.0によるアニメーションキューの構築

jquery btwが新しくなりました。 jQuery 1.4.4とGalleriffic 2.0を使用しており、Gallerifficのダウンロードに含まれている例を取り上げています。

答えて

1

わかりました。サムネイルをマウスで操作するときの透明度の低下は、 "jquery.opacityrollover.js"というスクリプトで処理されることがわかりました。

透明度はjquery "animate"関数ではアニメーション化されませんが、代わりに "fadeTo"関数でアニメーション化されます。コードは次のようになります。

/** 
* 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); 

は、だから私は裁判を通じて、あなたがしなければならないすべてが変更されていることをテストする考え出し

$target.fadeTo(config.fadeSpeed, opacity); 

$target.stop().fadeTo(config.fadeSpeed, opacity); 
関連する問題