Mouseover-Bildwechsel: Darstellungsproblem mit Opera

Status
Nicht offen für weitere Antworten.

Parasite

Mitglied
Hallo Leute,

ich habe auf meiner Seite ein horizontales Menü, dessen Buttons sich bei Mouseover verändern.

Soweit funktioniert das ganze auch wunderbar bis ich heute feststellen musste, dass es in Opera einen kleinen Schönheitsfehler gibt:
Wenn man mit der Maus über ein nicht ausgewähltes Menübild fährt, verschiebt sich meine ganze Seite (also nicht nur das Menü) um ca. 1 Pixel nach rechts. Bei Mouseout verschiebt sie sich nicht zurück, dahingegen aber schon, wenn man einen der Menüpunkte anklickt. (da ja dann eine Seite mit dem Menü neu geladen wird)

In Firefox 2/3, Internet Explorer 7 und Safari 3.1.2 tritt der Fehler nicht auf.

Hat jemand eine Ahnung woran das liegen könnte? :(


index.php:
PHP:
<head>

...

<?php
include("imgload.php");
?>
</head>

<body onLoad="Vorladen02()">
<div align="center" name="top">
<table width="960">

...

	<tr height="30">
		<td colspan='2' class='topmenu'>
			<?php
			include("topmenu.php");
			?>
		<!-- </td> -->
	</tr>

...

</table>
</div>

topmenu.php:
PHP:
if($thismenu == "news") { echo "<img src='../img/topmenu2_news2_".$_SESSION['language'].".jpg' border='0'>"; }
if($thismenu != "news") { echo "<a href='index.php' OnMouseOver=\"Wechseln('menu01','Grafik01b')\" OnMouseOut=\"Wechseln('menu01','Grafik01a')\"><img src='../img/topmenu2_news_".$_SESSION['language'].".jpg' border='0' name='menu01'></a>"; }
if($thismenu == "ueber_uns") { echo "<img src='../img/topmenu2_ueberuns2_".$_SESSION['language'].".jpg' border='0'>"; }
if($thismenu != "ueber_uns") { echo "<a href='ueber_uns.php' OnMouseOver=\"Wechseln('menu02','Grafik02b')\" OnMouseOut=\"Wechseln('menu02','Grafik02a')\"><img src='../img/topmenu2_ueberuns_".$_SESSION['language'].".jpg' border='0' name='menu02'></a>"; }
if($thismenu == "service") { echo "<img src='../img/topmenu2_service2_".$_SESSION['language'].".jpg' border='0'>"; }
if($thismenu != "service") { echo "<a href='service.php' OnMouseOver=\"Wechseln('menu03','Grafik03b')\" OnMouseOut=\"Wechseln('menu03','Grafik03a')\"><img src='../img/topmenu2_service_".$_SESSION['language'].".jpg' border='0' name='menu03'></a>"; }
if($thismenu == "produkte") { echo "<img src='../img/topmenu2_produkte2_".$_SESSION['language'].".jpg' border='0'>"; }
if($thismenu != "produkte") { echo "<a href='produkte.php' OnMouseOver=\"Wechseln('menu04','Grafik04b')\" OnMouseOut=\"Wechseln('menu04','Grafik04a')\"><img src='../img/topmenu2_produkte_".$_SESSION['language'].".jpg' border='0' name='menu04'></a>"; }
if($thismenu == "impressum") { echo "<img src='../img/topmenu2_impressum2_".$_SESSION['language'].".jpg' border='0'>"; }
if($thismenu != "impressum") { echo "<a href='impressum.php' OnMouseOver=\"Wechseln('menu05','Grafik05b')\" OnMouseOut=\"Wechseln('menu05','Grafik05a')\"><img src='../img/topmenu2_impressum_".$_SESSION['language'].".jpg' border='0' name='menu05'></a>"; }
echo "</td>";
// unbedingt das </td> nach dem letzten Menübild nicht vergessen!! (sonst Anzeigefehler im IE)

imgload.php:
PHP:
<!-- Bilder vorladen -->
<script type="text/javascript">
var BildArray = new Array();

BildArray[0] = "../img/topmenu2_news.jpg";
BildArray[1] = "../img/topmenu2_news2.jpg";
BildArray[2] = "../img/topmenu2_ueberuns.jpg";
BildArray[3] = "../img/topmenu2_ueberuns2.jpg";
BildArray[4] = "../img/topmenu2_service.jpg";
BildArray[5] = "../img/topmenu2_service2.jpg";
BildArray[6] = "../img/topmenu2_produkte.jpg";
BildArray[7] = "../img/topmenu2_produkte2.jpg";
BildArray[8] = "../img/topmenu2_impressum.jpg";
BildArray[9] = "../img/topmenu2_impressum2.jpg";


function Vorladen02()
{
  for (i=0; i < BildArray.length; i++) {
    var Bild = new Image();
    Bild.src = BildArray[i];
  }
}

<?php
$pfad = $HTTP_SERVER["DOCUMENT_ROOT"]."../img";

echo "Grafik01a = new Image();";
echo "Grafik01a.src = \"".$pfad."/topmenu2_news_".$_SESSION['language'].".jpg\";          /* Standard-Grafik */";
echo "Grafik01b = new Image();";
echo "Grafik01b.src = \"".$pfad."/topmenu2_news2_".$_SESSION['language'].".jpg\";          /* Highlight-Grafik */";
echo "Grafik02a = new Image();";
echo "Grafik02a.src = \"".$pfad."/topmenu2_ueberuns_".$_SESSION['language'].".jpg\";          /* Standard-Grafik */";
echo "Grafik02b = new Image();";
echo "Grafik02b.src = \"".$pfad."/topmenu2_ueberuns2_".$_SESSION['language'].".jpg\";          /* Highlight-Grafik */";
echo "Grafik03a = new Image();";
echo "Grafik03a.src = \"".$pfad."/topmenu2_service_".$_SESSION['language'].".jpg\";          /* Standard-Grafik */";
echo "Grafik03b = new Image();";
echo "Grafik03b.src = \"".$pfad."/topmenu2_service2_".$_SESSION['language'].".jpg\";          /* Highlight-Grafik */";
echo "Grafik04a = new Image();";
echo "Grafik04a.src = \"".$pfad."/topmenu2_produkte_".$_SESSION['language'].".jpg\";          /* Standard-Grafik */";
echo "Grafik04b = new Image();";
echo "Grafik04b.src = \"".$pfad."/topmenu2_produkte2_".$_SESSION['language'].".jpg\";          /* Highlight-Grafik */";
echo "Grafik05a = new Image();";
echo "Grafik05a.src = \"".$pfad."/topmenu2_impressum_".$_SESSION['language'].".jpg\";          /* Standard-Grafik */";
echo "Grafik05b = new Image();";
echo "Grafik05b.src = \"".$pfad."/topmenu2_impressum2_".$_SESSION['language'].".jpg\";          /* Highlight-Grafik */";

echo "function Wechseln(Objektname,Tauschbild) {";
echo "document.images[Objektname].src = eval(Tauschbild + \".src\")";
echo "}";
?>

</script>
 
Hi,

steht die Seite online zur Verfügung, um dort mal direkt einen Blick drauf werfen zu können, und zudem auch in den "Genuß der eingebundenen Bilder" zu kommen?

mfg Maik
 
Die Seite kann und darf ich leider noch nicht online zugänglich machen. :(

Jedes der Menübilder ist übrigens 192x30 Pixel groß...
 
Dann poste bitte mal den PHP-geparsten Code, sprich den vom Browser ausgegebenen HTML-Code.

Und falls für die Seite eine Stylesheet-Formatierung existiert, wäre die auch ganz hilfreich.

mfg Maik
 
Ok, hier mal der HTML Code:

HTML:
<html>
<head><title>W.I.P.</title>
	
<link rel="stylesheet" type="text/css" href="css/main.css" />

<!-- Meta -->
<meta name="author" content="REEL Reinheimer Elektronik GmbH">
<meta name="copyright" content="REEL Reinheimer Elektronik GmbH Felsweg 6a 35435 Wettenberg">
<meta name="publisher-email" content="info@reinheimer-elektronik.de">
<meta name="reply-to" content="info@reinheimer-elektronik.de">
<meta name="date" content="2008">
<meta name="title" content="REEL Reinheimer Elektronik GmbH">
<meta name="description" content="Internet Auftritt der Firma REEL Reinheimer Elektronik GmbH Deutschland - Website of REEL Reinheimer Elektronik GmbH in Germany">
<meta name="keywords" content="antennen, antennas, mobilfunk, navigation, telematik, gsm, gps">
<meta name="robots" CONTENT="index,follow">
<link rev="made" content="mailto:info@reinheimer-elektronik.de">
<meta name="language" content="Deutsch, deutsch, de, ch, au, german, English, english, eng">
<meta name="audience" content="Alle, All">
<meta name="page-type" content="Internetseite der Firma REEL Reinheimer Elektronik GmbH">

<!-- Bilder vorladen -->
<script type="text/javascript">
var BildArray = new Array();

BildArray[0] = "../img/topmenu2_news.jpg";
BildArray[1] = "../img/topmenu2_news2.jpg";
BildArray[2] = "../img/topmenu2_ueberuns.jpg";
BildArray[3] = "../img/topmenu2_ueberuns2.jpg";
BildArray[4] = "../img/topmenu2_service.jpg";
BildArray[5] = "../img/topmenu2_service2.jpg";
BildArray[6] = "../img/topmenu2_produkte.jpg";
BildArray[7] = "../img/topmenu2_produkte2.jpg";
BildArray[8] = "../img/topmenu2_impressum.jpg";
BildArray[9] = "../img/topmenu2_impressum2.jpg";


function Vorladen02()
{
  for (i=0; i < BildArray.length; i++) {
    var Bild = new Image();
    Bild.src = BildArray[i];
  }
}

Grafik01a = new Image();Grafik01a.src = "../img/topmenu2_news_de.jpg";          /* Standard-Grafik */Grafik01b = new Image();Grafik01b.src = "../img/topmenu2_news2_de.jpg";          /* Highlight-Grafik */Grafik02a = new Image();Grafik02a.src = "../img/topmenu2_ueberuns_de.jpg";          /* Standard-Grafik */Grafik02b = new Image();Grafik02b.src = "../img/topmenu2_ueberuns2_de.jpg";          /* Highlight-Grafik */Grafik03a = new Image();Grafik03a.src = "../img/topmenu2_service_de.jpg";          /* Standard-Grafik */Grafik03b = new Image();Grafik03b.src = "../img/topmenu2_service2_de.jpg";          /* Highlight-Grafik */Grafik04a = new Image();Grafik04a.src = "../img/topmenu2_produkte_de.jpg";          /* Standard-Grafik */Grafik04b = new Image();Grafik04b.src = "../img/topmenu2_produkte2_de.jpg";          /* Highlight-Grafik */Grafik05a = new Image();Grafik05a.src = "../img/topmenu2_impressum_de.jpg";          /* Standard-Grafik */Grafik05b = new Image();Grafik05b.src = "../img/topmenu2_impressum2_de.jpg";          /* Highlight-Grafik */function Wechseln(Objektname,Tauschbild) {document.images[Objektname].src = eval(Tauschbild + ".src")}
</script>
</head>

<body onLoad="Vorladen02()">
<div align="center" name="top">
<table width="960">
	<tr height="148">
		<td colspan="2" class="kopf" style="background-image: url(../img/header2.jpg); background-repeat: no-repeat;" valign="bottom">
			<p align="right">
				<table width="270" class="noborder">
					<tr>
						<td class="kopf2" width="99%">
							<p>
								<!-- Text, Links, etc. -->
							</p>
						</td>
					</tr>
					<tr>
						<td class="kopf2">
							<p align="right">
								<a href='index.php?lang=en'><img src='../img/en.gif' border='0'></a>							</p>
						</td>
					</tr>
				</table>
			</p>
		</td>
	</tr>
	<tr height="30">
		<td colspan="2" class="topmenu">
			<a href='index.php' OnMouseOver="Wechseln('menu01','Grafik01b')" OnMouseOut="Wechseln('menu01','Grafik01a')"><img src='../img/topmenu2_news_de.jpg' border='0' name='menu01'></a><img src='../img/topmenu2_ueberuns2_de.jpg' border='0'><a href='service.php' OnMouseOver="Wechseln('menu03','Grafik03b')" OnMouseOut="Wechseln('menu03','Grafik03a')"><img src='../img/topmenu2_service_de.jpg' border='0' name='menu03'></a><a href='produkte.php' OnMouseOver="Wechseln('menu04','Grafik04b')" OnMouseOut="Wechseln('menu04','Grafik04a')"><img src='../img/topmenu2_produkte_de.jpg' border='0' name='menu04'></a><a href='impressum.php' OnMouseOver="Wechseln('menu05','Grafik05b')" OnMouseOut="Wechseln('menu05','Grafik05a')"><img src='../img/topmenu2_impressum_de.jpg' border='0' name='menu05'></a></td>		</td>
	</tr>
	<tr>
		<td width="165" height="100" class="kopf" valign="top" style="border-bottom: none;">
			<div style="height: 200px;"><br><font color="white">&nbsp;&Uuml;ber uns:</font><br><br><a href="uu_profil.php" class="hell">&nbsp;&nbsp;Profil<a><br><a href="uu_ansprech.php" class="hell">&nbsp;&nbsp;Ansprechpartner<a><br><a href="uu_distri.php" class="hell">&nbsp;&nbsp;Distributoren<a><br><a href="uu_refs.php" class="hell">&nbsp;&nbsp;Referenzen<a><br><a href="uu_agb.php" class="hell">&nbsp;&nbsp;Allgemeine<br>&nbsp;&nbsp;Gesch&auml;ftsbedingungen<a><br></div>		</td>
		<td valign='top'>
			<p align='center'>
				
			<!-- Content -->
			
			<br><table width='700'>	<tr height='10'>		<td class='kopf' background='../img/balken_top.jpg'>		</td>	</tr>	<tr height='180'>		<td class='inhalt' valign='top'>						<div class='inhalt' align='justify'>
						...
						</div>
								</td>	</tr>	<tr height='10'>		<td class='kopf' background='../img/balken_bottom.jpg'>		</td>	</tr></table><br>			
			<!-- /Content -->
			
			</p>
		</td>
	</tr>
	<tr height="20">
		<td colspan="2" class="kopf" background="../img/balken.jpg"><div align="center"><a href="#top" class="hell">Seitenanfang</a></div>
		</td>
	</tr>
</table>
</div>
</body>
</html>

und das dazugehörige Stylesheet:
Code:
body { color: #000000; background-color: #AAAAAA; font-family: Arial; }
img.link { border: none; margin: 0.8px; }
div { color: #000000; font-family: Arial; padding: 0px; margin: 0.8px; font-size: 12px; }
div.inhalt { padding: 3px; }
div.inhalt2 { border: 1px solid #000000; background-color: #FFFFFF; padding: 3px; font-size: 10px; }
div.preis { font-size: 24px; font-weight: bold; color: #6666AA; }
div.redf { font-style: italic; font-size: 10px; color: #FF0000; }
table { border: 1px solid #FFFFFF; border-collapse: collapse; padding: 0px; margin: 0.8px; font-size: 12px; }
table.inner { border: 1px solid #000000; }
table.outer { border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: 1px solid #000000; border-bottom: 1px solid #000000; }
table.nomargin { margin: 0px; }
table.noborder { border: none; margin: 0px; }
table.noborder2 { border: none; margin: 0.8px; }
td.kopf { border: 1px solid #FFFFFF; font-weight: bold; background-color: #3344CC; padding: 3px; }
td.topmenu { border: 1px solid #FFFFFF; background-color: #3344CC; padding: 0px; margin: 0px; }
td.kopf2 { border: none; font-weight: bold; background-color: #3344CC; padding: 0px; }
td.kopf3 { border: 1px solid #000000; font-weight: bold; background-color: #3344CC; padding: 3px; color: #FFFFFF; }
td.inhalt { border: 1px solid #FFFFFF; background-color: #FFFFFF; padding: 3px; }
td.inhalt2 { border: 1px solid #000000; background-color: #FFFFFF; padding: 3px; font-size: 10px; }
td.inhalt3 { border: 1px solid #000000; background-color: #FFFFFF; padding: 3px; }
td.inner { border: none; background-color: #FFFFFF; padding: 3px; }
a:link {  font-weight: bold; text-decoration: none; color: #5555CC; }
a:visited {  font-weight: bold; text-decoration: none; color: #5555CC; }
a:focus {  font-weight: bold; text-decoration: none; color: #6666FF; }
a:hover {  font-weight: bold; text-decoration: none; color: #6666FF; }
a:active{  font-weight: bold; text-decoration: none; color: #8888FF; }
a.hell:link {  font-weight: bold; text-decoration: none; color: #CCCCFF; }
a.hell:visited {  font-weight: bold; text-decoration: none; color: #CCCCFF; }
a.hell:focus {  font-weight: bold; text-decoration: none; color: #EEEEFF; }
a.hell:hover {  font-weight: bold; text-decoration: none; color: #EEEEFF; }
a.hell:active{  font-weight: bold; text-decoration: none; color: #AAAAFF; }
a.hell2:link {  font-weight: bold; text-decoration: none; color: #EEEEFF; }
a.hell2:visited {  font-weight: bold; text-decoration: none; color: #EEEEFF; }
a.hell2:focus {  font-weight: bold; text-decoration: none; color: #BBBBFF; }
a.hell2:hover {  font-weight: bold; text-decoration: none; color: #BBBBFF; }
a.hell2:active{  font-weight: bold; text-decoration: none; color: #8888FF; }
a.klein:link {  font-size: 9px; text-decoration: none; color: #5555CC; }
a.klein:visited {  font-size: 9px; text-decoration: none; color: #5555CC; }
a.klein:focus {  font-size: 9px; text-decoration: none; color: #6666FF; }
a.klein:hover {  font-size: 9px; text-decoration: none; color: #6666FF; }
a.klein:active{  font-size: 9px; text-decoration: none; color: #8888FF; }
 
So, ich hab mir das jetzt mal im Opera 9.27 & 9.5 angeschaut, aber da verschiebt sich überhaupt nichts, wenn ich über die einzelnen Menüpunkte fahre - getestet hab ich unter WinXp Prof. SP2.

mfg Maik


//edit#1: Okay, wenn ich den Grafiken das von dir erwähnte Format zuordne (192*30px), dann verschiebt sich die Tabelle nach rechts.

Erweiter daher mal das Stylesheet mit der folgenden Regelerweiterung:

Code:
td.topmenu a img, td.topmenu img { float:left; }
und setz die Breitenangabe für die umschliessende Tabelle auf "962", denn 5*192px (Grafikbreiten) + 2*1px (linker/rechter Rahmen der Tabellenzelle) = 962px.


//edit#2: Die Breitenerhöhung der Tabelle würde bei mir sogar ausreichen, wie ich gerade festgestellt habe.
 
Status
Nicht offen für weitere Antworten.

Neue Beiträge

Zurück