简体   繁体   English

更改字体图标(真棒字体)在IE中不起作用

[英]Changing font icon(font awesome) does not work in IE

I have a sliding pane in my html. 我的html中有一个滑动窗格。 I am using an icon that is pointing left to show that the pane is collapsible. 我正在使用向左指向的图标,以表明该窗格是可折叠的。 As soon as the user clicks the icon, I want to collapse the window and change the icon so it is pointing to right to show that it is expandable. 用户单击图标后,我要折叠窗口并更改图标,使其指向右侧以显示它是可扩展的。 My code works fine in chrome but the icon does not point to right after the click in IE. 我的代码在chrome中可以正常工作,但是在IE中单击后,该图标未指向右侧。 I am currently using IE 11. Any ideas on how I can fix this? 我当前正在使用IE11。有关如何解决此问题的任何想法?

    <div class="openClose" id="openClose">
        <div class="leftPanelClose">
            <a href="javascript:collapseExpand()"><i class="fa fa-angle-double-left" id="icon"</i></a>
        </div>
    </div>

function collapseExpand(){
    var ic = document.getElementById("icon");

    if (left.style.display=="block")
    {
    /*collapse pane*/
    ic.classList.remove("class", "fa-angle-double-left");
    ic.classList.add("class", "fa-angle-double-right");
    }
    else
    {
    /*expand pane*/
    ic.classList.remove("class", "fa-angle-double-right");
    ic.classList.add("class", "fa-angle-double-left");
    }
}

Did not need "class" argument when adding or removing classes from the icon. 从图标添加或删除类时不需要“ class”参数。

    <div class="openClose" id="openClose">
        <div class="leftPanelClose">
            <a href="javascript:collapseExpand()"><i class="fa fa-angle-double-left" id="icon"</i></a>
        </div>
    </div>

function collapseExpand(){
    var ic = document.getElementById("icon");

    if (left.style.display=="block")
    {
    /*collapse pane*/
    ic.classList.remove("fa-angle-double-left");
    ic.classList.add("fa-angle-double-right");
    }
    else
    {
    /*expand pane*/
    ic.classList.remove("fa-angle-double-right");
    ic.classList.add("fa-angle-double-left");
    }
}

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

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