I built a site about 6 months ago now and designed a menu with some interactivity using jQuery. It worked great in my friends (Firefox, Safari, etc).
Turns out that now IE7 & 8 are not playing ball.
The error in IE points to jQuery (on Google's CDN) with invalid argument.
The page can be viewed here. Move your mouse over the top headers to see what should happen in Firefox. This isn't happening in IE7/8.
Here is the source code of my effect
String.prototype.safe = function() {
var string = this;
string = string.toLowerCase().replace(/\s/g, '-');
string = string.replace(/&/g, 'and'); // & appears as just &
return string;
}
var subMenu = {
activeMenuId: 'submenu-about-us',
hideDelay: null,
init: function(){
var self = this;
$('#header').append('<div id="sub-menu"></div><div id="hover"></div>');
$('#background-elements').append('<span></span>');
var $subMenu = $('#sub-menu');
var $hover = $('#hover');
$('#menu li ul').each(function(){
var id = 'submenu-' + $(this).parents('li').find('.inner').text().safe();
$(this).attr({
id: id
}).prependTo($subMenu);
});
// move slider to where it should be
var uri = document.location.pathname;
uri = uri.replace(PATH_BASE + '/', '')
var uriSegments = uri.split('/');
var currentCategory = uriSegments[0];
if (currentCategory) {
var uriSegmentToListIndex = {};
uriSegmentToListIndex['about-us'] = 0;
uriSegmentToListIndex['tenant-advice-and-advocacy'] = 1;
uriSegmentToListIndex['housing-services'] = 2;
uriSegmentToListIndex['tenants'] = 3;
uriSegmentToListIndex['applicants'] = 4;
uriSegmentToListIndex['housing-development-projects'] = 5;
uriSegmentToListIndex['news-and-publications'] = 6;
uriSegmentToListIndex['contact'] = 7;
var currentListItemIndex = uriSegmentToListIndex[currentCategory];
var sliderDropShadowOffset = 14;
if (currentListItemIndex) {
var sliderLeft = $('#menu > li:eq(' + currentListItemIndex + ')').position().left + sliderDropShadowOffset;
}
$hover.css({
left: sliderLeft + 'px'
});
this.activeMenuId = 'submenu-' + currentCategory;
// make the right sub menu appear
$subMenu.find('ul').hide();
$('#submenu-' + currentCategory).fadeIn(500);
}
$('#menu li .inner').parents('li').hoverIntent(function(){
var id = 'submenu-' + $(this).find('.inner').text().safe();
if (id != self.activeMenuId) {
self.activeMenuId = id;
$subMenu.find('ul').hide();
var newLeft = $(this).position().left + sliderDropShadowOffset; // offset for drop shadow
$hover.animate({
left: newLeft + 'px'
}, 500, function(){
$subMenu.find('ul').hide(); // sometimes some remain
$('#' + id).fadeIn(800);
});
}
}, function(){
// do nothing!
});
}
}
I've tried the usual suspects and had a go with IE8 developer tools, but have not figured this one out yet. So I'm turning to the Stack Overflow community :)
Anyone know the issue?