繁体   English   中英

jQuery向下切换箭头“切换”

[英]jQuery toggle arrow down 'ontoggle'

嗨,我有以下内容: FIDDLE

本质上是手风琴切换菜单。 我要尝试的是一旦菜单已打开打开,就将箭头从正确的位置旋转到向下的位置。 菜单关闭后,我希望箭头向右旋转。 我尝试通过找到CSS和

transform: rotate(-90deg)

但是,箭头的位置不会改变。 思考? 这是<script>

//Dekstop Content
$('.content').each(function () {
    var $accordian = $(this);
    $accordian.find('.view').on('click', function () {
        $accordian.find('.content-body').slideUp();
        $accordian.find('span').css("transform", 'rotate(0deg);');
        if (!$(this).next().is(':visible')) {
            $(this).next().slideDown();
            $(this).find('span').css({"transform": 'rotate(90deg);'})
        }
    });
});

.css应该如下所示: .css('Property-Name','Value')

试试这个代码:

//Dekstop Content
$('#content').each(function () {
    var $accordian = $(this);
    $accordian.find('.view').on('click', function () {
        $accordian.find('.content-body').slideUp();
        $accordian.find('span').css('transform','rotate(0deg)'); // Changed
        if (!$(this).next().is(':visible')) {
            $(this).next().slideDown();
            $(this).find('span').css('transform', 'rotate(90deg)'); // Changed
        }
    });
});

维也纳的问候

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM