0
我已經在模板文件中使用easy2map插件在WordPress和jQuery標籤,如下衝突
:
<ul id="tabs">
<li><a href="#" name="#tab1">Own Unit</a></li>
<li><a href="#" name="#tab2">Franchise Unit</a></li>
</ul>
<div id="tabbed-content">
<div id="tab1">
//short code of map 1
</div>
<div id="tab2">
//short code of map 2
</div>
</div>
jQuery中:
<script type="text/javascript">
var map=jQuery.noConflict(true);
function resetTabs(){
map("#tabbed-content > div").hide(); //Hide all content
map("#tabs a").attr("id",""); //Reset id's
}
var myUrl = window.location.href; //get URL
var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For localhost/tabs.html#tab2, myUrlTab = #tab2
var myUrlTabName = myUrlTab.substring(0,4); // For the above example, myUrlTabName = #tab
(function(){
map("#tabbed-content > div").hide(); // Initially hide all content
map("#tabs li:first a").attr("id","current"); // Activate first tab
map("#tabbed-content > div:first").fadeIn(); // Show first tab content
map("#tabs a").on("click",function(e) {
e.preventDefault();
if (map(this).attr("id") == "current"){ //detection for current tab
return
}
else{
resetTabs();
map(this).attr("id","current"); // Activate this
map(map(this).attr('name')).fadeIn(); // Show content for current tab
}
});
for (i = 1; i <= map("#tabs li").length; i++) {
if (myUrlTab == myUrlTabName + i) {
resetTabs();
map("a[name='"+myUrlTab+"']").attr("id","current"); // Activate url tab
map(myUrlTab).fadeIn(); // Show url tab content
}
}
})()
我的問題是地圖獲取完全加載在tab1中,但不是在tab2 ....請幫助我!
請問你可以指定哪個類或id應該給css上面的屬性 – Nida 2013-05-13 16:14:32
也許這個將幫助http://jsfiddle.net/YXNQU/ – VitVad 2013-05-13 16:27:54
Thankyou這麼多....優秀的解決方案 – Nida 2013-05-18 04:45:58