addClass removeClass不适用于internet explorer



有人知道为什么这在ie中不起作用吗?似乎所有版本的IE都坏了,不知道为什么。在除IE之外的所有浏览器中,它都会找到图像,删除隐藏类并添加显示类。

onClickMakeActive("acousticCompression");
onClickMakeActive("Chiropractor");
onClickMakeActive("healthCoaching");
onClickMakeActive("oneOnOne");
function onClickMakeActive(className){  
    $("li."+className+"").click(function(){
        var defaultDescription = $(".defaultDescription");
        if(!defaultDescription.hasClass("hide")){
            defaultDescription.addClass("hide");
        }
        var myThis = $(this);
        makeActive(myThis, className);
        $(".DONTHIDE").show();
    });
}
function makeActive(myThis, className){
    myThis.siblings().removeClass("active");
    myThis.addClass("active");
    myThis.siblings().find(".pointer").removeClass("show").addClass("hide");
    myThis.find(".pointer").removeClass("hide").addClass("show");
    var itemsToToggle = "."+className+"Toggle";
    $(itemsToToggle).siblings().not(".dontHide").removeClass("show").addClass("hide");
    $(itemsToToggle).removeClass("hide").addClass("show");
}

这是HTML以防万一

<div class="clearfix typeWrapper">
    <ul class="serviceType dontHide">
        <li class="acousticCompression"><a class="acousticCompression servicesTypes">Acoustic Compression</a><span class="pointer hide"></span></li>
        <li class="healthCoaching"><a class="healthCoaching servicesTypes">Health Coaching</a><span class="pointer hide"></span></li>
        <li class="Chiropractor"><a class=" servicesTypes">Chiropractic Care</a><span class="pointer hide"></span></li>
        <li class="oneOnOne"><a class="oneOnOne servicesTypes">Comprehensive Holistic Care</a><span class="pointer hide"></span></li>
    </ul>
    <p class="defaultDescription">carefully selected and extensively trained a team of providers, who are all available to serve you either through his direction or as your direct provider</p>
    <img class="managedHolisticCareToggle serviceTypeImage hide" src="[@RelImageRoot]/PatientIntakeForm/managedHolisticCare.jpg" alt="managed Holistic Care" width="" height="" />
    <img class="acousticCompressionToggle serviceTypeImage hide" src="[@RelImageRoot]/PatientIntakeForm/acousticCompression.jpg" alt="acoustic Compression" width="" height="" />
    <img class="ChiropractorToggle serviceTypeImage hide" src="[@RelImageRoot]/PatientIntakeForm/Chiropractor.jpg" alt="Chiropractor" width="" height="" />
    <img class="healthCoachingToggle serviceTypeImage hide" src="[@RelImageRoot]/PatientIntakeForm/healthCoaching.jpg" alt="health Coaching" width="" height="" />
    <img class="oneOnOneToggle serviceTypeImage hide" src="[@RelImageRoot]/PatientIntakeForm/one-on-one.jpg" alt="one-on-one" width="" height="" />
</div>

我没有看到任何错误返回,所以我有点困惑。

有问题页面的链接https://beta.teammotio.com/drdenboer/Patient_Intake

查看您的网站,这似乎不是代码不工作的问题,而是图像大小的问题。你的5张图片在IE中的宽度="1",高度为"1"。我想还有其他代码在修改它。

<img width="1" height="1" class="managedHolisticCareToggle serviceTypeImage hide" alt="managed Holistic Care" src="/drdenboer/userfiles/image//PatientIntakeForm/managedHolisticCare.jpg">
<img width="1" height="1" class="oneOnOneToggle serviceTypeImage show" alt="one-on-one" src="/drdenboer/userfiles/image//PatientIntakeForm/one-on-one.jpg">

我想到的最直接的事情就是改变

$(".DONTHIDE").show();

$(".dontHide").show();

这些不应该区分大小写,但是。。。

最新更新