I have this tabs that are working perfect in any browser apart from IE 9. Have been trying to solve this problem for days now, and I think I’m going completely mad.
<div class="product-collateral">
<div class="tab"><h3 class="product_tabs_additional">Additional Information</h3></div>
<div class="product-tabs-content" id="product_tabs_additional_contents">
Additional Information Content
</div>
<div class="tab"><h3 class="product_tabs_agenda">Agenda</h3></div>
<div class="product-tabs-content" id="product_tabs_agenda_contents">
Agenda Content
</div>
<div class="tab"><h3 class="product_tabs_terms">Terms and Conditions</h3></div>
<div class="product-tabs-content" id="product_tabs_terms_contents">
Terms and Conditions Content
</div>
<div class="tab"><h3 class="product_tabs_locations">Locations</h3></div>
<div class="product-tabs-content" id="product_tabs_locations_contents">
Locations Content
</div></div>
<script type = "text/javascript" > $jQ = jQuery.noConflict();
$jQ('.product-collateral .tab h3').wrapAll('<ul class="product-tabs"></ul>').wrap('<li></li>');
$jQ('.product-collateral .product-tabs li').each(function(index) {
$jQ(this).attr('id', $jQ(this).find('h3').attr('class'));
if (index === 0) {
$jQ(this).addClass('active');
}
});
//<![CDATA[
Varien.Tabs = Class.create();
Varien.Tabs.prototype = {
initialize: function(selector) {
var self = this;
$$(selector + ' h3').each(this.initTab.bind(this));
},
initTab: function(el) {
el.href = 'javascript:void(0)';
if ($(el.parentNode).hasClassName('active')) {
this.showContent(el);
}
el.observe('click', this.showContent.bind(this, el));
},
showContent: function(a) {
var li = $(a.parentNode),
ul = $(li.parentNode);
ul.select('li', 'ol').each(function(el) {
var contents = $(el.id + '_contents');
if (el == li) {
el.addClassName('active');
contents.show();
} else {
el.removeClassName('active');
contents.hide();
}
});
}
}
new Varien.Tabs('.product-tabs');
//]]>
< /script>
I know that one of the lines $$(selector + ' h3').each(this.initTab.bind(this)); there is a 2x$ but without it script stops working.
Im not a JavaScript specialist at all, hence my problem. Strangest for me is that this script is running in IE7 and 8 mode without any trouble. Only IE9 is breaking.
Any help much appreciated.
Thank you in advance
Dom
Please Check you code, and avoid declaring multiple versions of jQuery on the page. I think its the problem of jQuery conflict.