简体   繁体   English

手风琴.glyphicon-chevron-up和.glyphicon-chevron-down不起作用

[英]Accordion .glyphicon-chevron-up and .glyphicon-chevron-down not working

I am using an Accordion with up and down arrows -when run first time down arrow is displayed so user had to click to see data - the data is shown on clicking the down arrow but the up arrow is still shown and doesn't revert to up...I have a Javascript function which does the checking... 我正在使用带有向上和向下箭头的手风琴-第一次运行时会显示向下箭头,因此用户必须单击才能查看数据-单击向下箭头会显示数据,但仍会显示向上箭头,并且不会还原为up ...我有一个执行检查的Javascript函数...

Followed this link:- https://www.bootply.com/113766# 点击此链接:-https: //www.bootply.com/113766#

Javascript to change the arrows:- Javascript更改箭头:-

$(document).ready(function ()
{
      $('.collapse').on('shown.bs.collapse', function () {
      $(this).parent().find(
      ".glyphicon-chevron-up").removeClass("glyphicon-chevron-up")
      .addClass("glyphicon-chevron-down");

    }).on('hidden.bs.collapse', function ()
    {
        $(this).parent().find(".glyphicon-chevron-down")
        .removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron- 
        up");
    });
 });

HTML:- HTML: -

<div class="accordion">
<h4 class="up">
    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
       Testing
        <span class="glyphicon  glyphicon-chevron-up" style="float: right"></span>
    </a>

</h4>


<div id="collapseOne" class="collapse">

The default arrow is always displayed - the data is displayed on click 始终显示默认箭头-单击时显示数据

在此输入图像描述

原来是指向错误的JQuery版本-现在都可以使用...

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

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