首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Waypoint启动Jquery动画

使用Waypoint启动Jquery动画
EN

Stack Overflow用户
提问于 2014-02-17 21:50:40
回答 1查看 225关注 0票数 0

我使用的是Jquery Knob,它在页面加载时自动运行。我似乎找不到在这个函数中插入Waypoint调用的位置。任何建议都是非常感谢的。

代码语言:javascript
复制
            <script>
                 $(document)(function () {
                    $('.dial').knob({
                        min: '0',
                        max: '100',
                        readOnly: true
                    });

                    $('.dial').each(function(){
                        $(this).animate({
                            value: $(this).data('number')
                        },{
                            duration: 950,
                            easing: 'swing',
                            progress: function () {
                                $(this).val(Math.round(this.value)).trigger('change');
                            } // progress:function
                        }); // middle
                    }); //dial.each.function
                }); // function
                </script>
EN

回答 1

Stack Overflow用户

发布于 2014-10-07 11:37:56

下面的方法应该是可行的。

代码语言:javascript
复制
$(document)(function () {
    $('.thing').waypoint(function(direction) {  // Change ".thing" to the div class containing your knobs //
        $('.dial').knob({
           min: '0',
           max: '100',
           readOnly: true
         });

    $('.dial').each(function(){
        $(this).animate({
        value: $(this).data('number')
        },{
            duration: 950,
            easing: 'swing',
            progress: function () {
            $(this).val(Math.round(this.value)).trigger('change');
            } // progress:function
            }); // middle
        }); //dial.each.function
    });
}); // function
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21830846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档