I am working on an accordion content page which will show a section open on page load by adding anchor type number to the end of the url string. Such as the following: site/accordion_page.html#2
It works well in Firefox and Chrome but Internet Explorer 8 is not showing any of the accordion functionality. I have included a jsfiddle here: http://jsfiddle.net/w4v34/1/
Or please see my code below as well, thank you for assistance, Attila
$(document).ready(function() {
var allPanels = $('.accordion > dd').hide();
var allControlIcons = $('.accordion > span');
var urlString = $(location).attr('hash').slice(1);
var startN = (parseInt(urlString))-1; // minus one to make it zero based for the eq: numbering
console.log(startN);
$('.accordion dd:eq('+startN+')').addClass('active').show();
$('.accordion dt:eq('+startN+')').find('span').
empty().html('–');
$('.accordion > dt > a').click(function() {
$this = $(this);
$target = $this.parent().next();
$control = $this.find('span');
$('.accordion').find('span').empty().html('+');
$this.closest('dt').find('span').empty().html('–');
if(!$target.hasClass('active')){
allPanels.removeClass('active').slideUp("fast");
$target.addClass('active').slideDown("fast");
}
return false;
});
});