I'm not entirely sure what's breaking here on this page: http://grandoaks.org/floor.html but it seems to only be broken in IE7 (IE8, FF3, Safari, Opera, Chrome, Camino all worked). When you mouseover the names of the suites, it should show a description by removing an 'active' class and applying it to the corresponding div, with the stylesheet setting display:none to inactive divs and display:block to actives. The same method is being applied to the images and that works fine though. Any help on this issue would be much appreciated!
A:
Looking at this in IE 7 I can see that the "active" and "selected" classes are not being applied to the other div#unit# elements. I will look at the script, but something looks wrong there.
Dustin Laine
2010-03-15 21:25:02
Yeah, I noticed that problem too and fixed that... I wrote this site in a rush before I had any jQuery experience... Need to pay more attention now. Thanks for the help!
Bradley Herman
2010-03-16 13:35:35
+1
A:
You have the same ID being used in multiple places, I'd resolve it by doing this:
change your <li>
element to use rel=""
like this:
<ul id="apt-list">
<li rel="unit1" class="selected active"><span>Osprey</span></li>
...then in #sidebar...
<a ...><img rel="unit1" ... /></a>
Change your jquery to use that:
$("#apt-list li").click(function(){
$(".selected").removeClass("selected");
$(this).addClass("selected");
var id = $(this).attr("rel");
$("#sidebar img[rel="+ id +"], #"+id).addClass("selected");
});
$("#apt-list li").hover(function(){
$(".active").removeClass("active");
$(this).addClass("active");
var id = $(this).attr("rel");
$("#sidebar img[rel="+ id +"], #" + id).addClass("active");
},function(){
$(".active").removeClass("active");
$(".selected").addClass("active");
});
Nick Craver
2010-03-15 21:25:45
This solved the problem! Thanks a ton! I wrote this before I had a thorough understanding of the differences between classes and ids. I've never really used the 'rel' attribute before but it seems to work perfectly now. It's surprising that IE7 technically rendered it correctly whereas Firefox and other browsers didn't mind multiple uses of the same id.
Bradley Herman
2010-03-16 13:36:54