animate step()下拉列表右三角动画效果

本文档通过一个具体的示例展示了如何使用HTML与JavaScript来创建一个可交互的面板元素,其中包括了如何添加图标以及实现点击展开效果等功能。示例中详细介绍了如何利用jQuery库来操作DOM元素,实现面板头部图标旋转动画。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="http://lib.baomitu.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div id="running" class="tab-pane active">

          <div class="panel-group" id="accordion">
            <div class="panel panel-default">

              <div class="panel-heading">
                <a data-toggle="collapse" data-target="#collapseOne" href="#" aria-expanded="true" class="">
                  Terminals
                </a>
              </div>
            </div>
          </div>
        </div>
</body>


</html>
<script src="http://lib.baomitu.com/jquery/3.3.1/jquery.min.js"></script>

<script>
    $('#running .panel-group .panel .panel-heading a').each(function (index, el) {
        var isRTL = 1;
        var $link = $(el);
        var $icon = $('<i />').addClass('glyphicon glyphicon-triangle-bottom');
        $link.append($icon);
        $link.down = true;
        $link.click(function () {
            if ($link.down) {
                $link.down = false;

                $icon.animate(
                    {
                    borderSpacing: 90,
                },
                    {
                    step: function (now, fx) {
                        isRTL== 2 ? $icon.css('transform', 'rotate(' + now + 'deg)') : $icon.css('transform', 'rotate(-' + now + 'deg)');
                    }
                },
                    250
                );
            } else {
                $link.down = true;
                // See comment above.
                $icon.animate({borderSpacing: 0}, {
                    step: function (now, fx) {
                        isRTL== 2 ? $icon.css('transform', 'rotate(' + now + 'deg)') : $icon.css('transform', 'rotate(-' + now + 'deg)');
                    }
                }, 250);
            }
        });
    });

</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值