I'm running Drupal, and have enabled "Aggregate and compress CSS files" as well as "Aggregate JavaScript files". I am using the following jQuery to add a class to one of the elements, which works perfectly.
However, when I enable "Aggregate and compress CSS files", the desired result does not happen in IE7 and IE8. It works fine in Firefox, Safari and Chrome.
Drupal dynamically generates the compressed CSS and places it in a new directory.
Here is my jQuery:
(function ($, Drupal, window, document, undefined) {
$(document).ready(function(){
// ADD CLASS TO MAIN MENU ITEM WHEN CHILD UL IS HOVERED //
$("#menu-218-1 ul").hover(
function(){ $("li#menu-218-1 a.sf-depth-1").addClass('submenu_hover') },
function(){ $("li#menu-218-1 a.sf-depth-1").removeClass('submenu_hover') }
)
$("#menu-539-1 ul").hover(
function(){ $("li#menu-539-1 a.sf-depth-1").addClass('submenu_hover') },
function(){ $("li#menu-539-1 a.sf-depth-1").removeClass('submenu_hover') }
)
$("#menu-540-1 ul").hover(
function(){ $("li#menu-540-1 a.sf-depth-1").addClass('submenu_hover') },
function(){ $("li#menu-540-1 a.sf-depth-1").removeClass('submenu_hover') }
)
$("#menu-545-1 ul").hover(
function(){ $("li#menu-545-1 a.sf-depth-1").addClass('submenu_hover') },
function(){ $("li#menu-545-1 a.sf-depth-1").removeClass('submenu_hover') }
)
$("#menu-546-1 ul").hover(
function(){ $("li#menu-546-1 a.sf-depth-1").addClass('submenu_hover') },
function(){ $("li#menu-546-1 a.sf-depth-1").removeClass('submenu_hover') }
)
$("#menu-547-1 ul ").hover(
function(){ $("li#menu-547-1 a.sf-depth-1").addClass('submenu_hover') },
function(){ $("li#menu-547-1 a.sf-depth-1").removeClass('submenu_hover') }
)
});
})(jQuery, Drupal, this, this.document);
Here is my CSS:
.submenu_hover {
background: #888888 url(../images/arrow.png) no-repeat 97px 0px;
border-left: #888888 solid 9999px;
margin-left: -9999px;
}
.lt-ie8 .submenu_hover {
background: #888888 url(../images/arrow.png) no-repeat 97px 0px;
border-left: #888888 solid 9999px;
margin-left: -960px;
}