Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery scrollTo与easing和回调函数一起使用_Jquery_Callback_Scrollto_Easing - Fatal编程技术网

Jquery scrollTo与easing和回调函数一起使用

Jquery scrollTo与easing和回调函数一起使用,jquery,callback,scrollto,easing,Jquery,Callback,Scrollto,Easing,以下是我迄今为止的代码: $('.my_button').click(function() { $.scrollTo( '#my_anchor', 1200, {easing:'easeInOutExpo'}, function() { // function not working here }); }); 回调函数以前工作过,但由于我使用easing更改为scrollTo方法,它不再工作了

以下是我迄今为止的代码:

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

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

            // function not working here

        });

    });
回调函数以前工作过,但由于我使用easing更改为scrollTo方法,它不再工作了


为了明确起见,我只需要知道如何让回调函数再次工作,其他一切都很好。

没有第四个参数,但第三个参数(设置)接受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.

我在jQuery网站的任何地方都看不到这个
scrollTo()
方法。@vertaxe是
easeInOutExpo
一个有效的缓解功能吗?好吧,只是不要把我的评论考虑进去:/一切都很好,我正在使用scrollTo插件和用于jQuery的Easing插件——我只需要知道如何让回调函数也工作。