2

これまでの私のコードは次のとおりです。

    $('.my_button').click(function() {

        $.scrollTo( '#my_anchor', 1200, {easing:'easeInOutExpo'}, function() {          

            // function not working here

        });

    });

コールバック関数は以前は機能していましたが、簡単にscrollToメソッドに変更したため、機能しなくなりました。

明確にするために、コールバック関数を再び機能させる方法を知る必要があるだけです。それ以外はすべて問題ありません。

4

1 に答える 1

10

4番目のパラメーターはありませんが、3番目のパラメーター(設定)はonAfterコールバックを受け入れます

$.scrollTo( '#my_anchor', 1200, {easing:'easeInOutExpo', onAfter: function() { }});

設定のソースコードから:

 * @param {Object,Function} settings Optional set of settings or the onAfter callback.
 *   @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
 *   @option {Number} duration The OVERALL length of the animation.
 *   @option {String} easing The easing method for the animation.
 *   @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
 *   @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
 *   @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
 *   @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
 *   @option {Function} onAfter Function to be called after the scrolling ends.
 *   @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
于 2011-09-21T21:19:34.717 に答える