Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.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
Javascript jQuery向下切换箭头';ontoggle';_Javascript_Jquery_Html_Toggle - Fatal编程技术网

Javascript jQuery向下切换箭头';ontoggle';

Javascript jQuery向下切换箭头';ontoggle';,javascript,jquery,html,toggle,Javascript,Jquery,Html,Toggle,你好,我有以下信息: 它本质上是一个手风琴切换菜单。我要做的是在打开菜单后,将箭头从右位置旋转到向下位置。菜单关闭后,我希望箭头旋转回其右侧位置。我试着通过查找CSS和 transform: rotate(-90deg) 但是,箭头的位置不会改变。思想?这是 .css应该如下所示:.css('Property-Name','Value') 请尝试以下代码: //Dekstop Content $('#content').each(function () { var $accordian

你好,我有以下信息:

它本质上是一个手风琴切换菜单。我要做的是在打开菜单后,将箭头从右位置旋转到向下位置。菜单关闭后,我希望箭头旋转回其右侧位置。我试着通过查找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
        }
    });
});

来自维也纳的问候语

你们都有旋转(-90度),在你们的情况下,其中一个应该是旋转(0度)…为什么有
$(“#内容”)。每个(…)
?id选择器只能找到一个(或没有)元素因此变成:
.css('transform','rotate(-90deg)
将修复它。我建议也在css中添加一个
span.updown{transition:all 0.4s linear;}
以获得美观(),但无论如何,+1。
//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
        }
    });
});