开发者

JQuery Slider animation

I would like to animate that slider, http://jqueryui.com/demos/slider/#option-animate so basically when it moves to from one to the other position movement is smooth, i implemented that code but it doesn't work for me:

<script>
 开发者_运维知识库   $(function() {
        $( "#tabs" ).tabs({
            select: function( event, ui ) {
                $( "#slider" ).slider( "value", ui.index );
            }


        });
        $( "#slider" ).slider({


            min: 0,
            max: $( "#tabs" ).tabs( "length" ) - 1,
            slide: function( event, ui ) {
                $( "#tabs" ).tabs( "select", ui.value );


                },


            animate: true
        });
    });
    </script>


You broke the animation when you set the slide: { ... } options. Adding $(this).slide(); fixes the animation

$(function() {
    $("#tabs").tabs({
        select: function(event, ui) {
            $("#slider").slider("value", ui.index);
        }
    });
    $("#slider").slider({
        min: 0,
        max: $("#tabs").tabs("length") - 1,
        slide: function(event, ui) {
            $("#tabs").tabs("select", ui.value);
            $(this).slide(); // fixes the animation
        },
        animate: true
    });
});

DEMO HERE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜