【发布时间】:2018-02-05 18:42:26
【问题描述】:
我在使用hide(); 方法隐藏地图图像时遇到问题,它适用于除 IE11 之外的 Chrome、FF、Safari 和 Edge 等浏览器。
我读过其他类似的问题,说 IE11 不喜欢 hide/show()。我试过这个方法$(".mapActive").css({'display':'none'});,它在除IE11之外的所有浏览器上都可以正常工作。
JS
$(document).ready(function() {
"use strict";
$(".mapActive").hide();
$("ul.j_linkLocation li#mapTX").addClass("active").show();
$(".mapActive#mapTX").show();
$("ul.j_linkLocation li").click(function() {
$("ul.j_linkLocation li").removeClass("active");
$(this).addClass("active");
$(".mapActive").hide();
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn('fast');
return false;
});
});
HTML
<div class="row m_activeMap">
<div class="col-lg col-map-width">
<div class="j_img-overlay"><img src="imgs/img-overlay.png" alt="Seek the World! | SVRS" id="imghide"></div>
<div class="j_map-interfaces">
<div id="mapTX" class="mapActive"><img src="imgs/map-TX.png" alt="Seek the World - Texas" class="m_map"></div>
<div id="mapLA" class="mapActive"><img src="imgs/map-LA.png" alt="Seek the World - Louisiana" class="m_map"></div>
<div id="mapMI" class="mapActive"><img src="imgs/map-MI.png" alt="Seek the World - Mississippi" class="m_map"></div>
<div id="mapAL" class="mapActive"><img src="imgs/map-AL.png" alt="Seek the World - Alabama" class="m_map"></div>
<div id="mapGA" class="mapActive"><img src="imgs/map-GA.png" alt="Seek the World - Georgia" class="m_map"></div>
<div id="mapFL" class="mapActive"><img src="imgs/map-FL.png" alt="Seek the World - Florida" class="m_map"></div>
<!--<div id="mapSC" class="mapActive"><img src="imgs/map-SC.png" alt="Seek the World - South Carolina" class="m_map"></div>
<div id="mapNC" class="mapActive"><img src="imgs/map-NC.png" alt="Seek the World - North Carolina" class="m_map"></div>
<div id="mapVA" class="mapActive"><img src="imgs/map-VA.png" alt="Seek the World - Virginia" class="m_map"></div>-->
<div id="mapMD" class="mapActive"><img src="imgs/map-MD.png" alt="Seek the World - Maryland" class="m_map"></div>
<!--<div id="mapWV" class="mapActive"><img src="imgs/map-WV.png" alt="Seek the World - West Virginia" class="m_map"></div>-->
</div>
</div>
<div class="col-lg-3">
<div class="j_linkHeader"><img src="imgs/link-header.png" alt="Seek the location below!"></div>
<div class="j_linkHeader2"><p>Seek the location below!</p></div>
<div id="j_mapLinks" class="j_linksCol">
<ul class="j_linkLocation">
<li class="j_linkHover is-active">
<a href="#mapTX" class="j_linkThumb"> Austin, TX</a>
<p class="j_accordion-panel">Texas School for the Deaf<br>1234 Congress Ave, <br>Austin, TX 78753<br>
<span class="j_dateLocation">Feb 7, 2018</span></p>
</li>
<li class="j_linkHover">
<a href="#mapLA" class="j_linkThumb"> Baton Rouge, LA</a>
<p class="j_accordion-panel">Rouge School for the Deaf<br>1234 Easy Ave, <br>Baton Rouge, LA 68753<br>
<span class="j_dateLocation">Feb 18, 2018</span></p>
</li>
<li class="j_linkHover">
<a href="#mapMI" class="j_linkThumb"> Jackson, MI</a>
<p class="j_accordion-panel">School for the Deaf<br>1234 NoWay Ave, <br>Jackson, MI 58753<br>
<span class="j_dateLocation">Feb 18, 2018</span></p>
</li>
<li class="j_linkHover">
<a href="#mapAL" class="j_linkThumb"> Talladega, AL</a>
<p class="j_accordion-panel">Mobile for the Deaf<br>1234 Whoo Ave, <br>Talladega, AL 48753<br>
<span class="j_dateLocation">Feb 25, 2018</span></p>
</li>
<li class="column-break"></li>
<li class="j_linkHover">
<a href="#mapFL" class="j_linkThumb"> St Augustine, FL</a>
<p class="j_accordion-panel"> Florida School for the Deaf<br>1234 Ouch Ave, <br> St Augustine, FL 48753<br>
<span class="j_dateLocation">Mar 12, 2018</span></p>
</li>
<li class="j_linkHover">
<a href="#mapGA" class="j_linkThumb"> Atlanta, GA</a>
<p class="j_accordion-panel">Atlanta for the Deaf<br>1234 You Ave, <br>Atlanta, GA 38753<br>
<span class="j_dateLocation">Mar 12, 2018</span></p>
</li>
<li class="j_linkHover">
<a href="#mapMD" class="j_linkThumb"> Frederick, MD</a>
<p class="j_accordion-panel">Frederick for the Deaf<br>1234 You Ave, <br>Frederick, MD 38753<br>
<span class="j_dateLocation">Mar 12, 2018</span></p>
</li>
</ul>
</div>
</div>
</div>
这是我在将项目交付给客户之前遇到的唯一问题。
【问题讨论】:
-
请不要强迫我们访问损坏的链接或将来可能会关闭的链接。改为创建minimal reproducible example。
-
$('#item').css({'display':'block'},应该可以,你的链接失效了,我有时间了
-
链接失效了?我点击它,它显示了我工作的网站。
-
@Grumpy - 你从哪里得到
#item? -
请贴html代码
标签: javascript jquery css internet-explorer-11 show-hide