Ahoj, jak v JS udělat aby po najetí myší na div A zobrazil zaroveň s divem A i div B, který bude nastylovaný.Předem děkujii za odpovědi.
Fórum › JavaScript, AJAX, jQuery
Při události onmouseover zobraz div

Myslíš něco na způsob http://www.kosek.cz/html/src/249-1.html?
To pawlik : Jo jasně díky, ale jak by to vypadalo, kdyby základní div byl tenhle..
pocitadlo {
border: 1px solid #000000;
background: #b4dcf8;
height: 40px;
width: 120px;
position: absolute;
left: -1px;
bottom: -1px;
z-index: 2000;
}
a po najetí na něj se má zobrazit tohle
.onpocitadlo {
position: relative;
height: 120px;
width: 120px;
border: 1px solid #000;
background: #b4dcf8;
z-index: 5555;
left: 150px;
bottom: 150px;
display: block;
}
Vyzkoušej něco na způsob tohodle, kdyby sis nevěděl rady, napiš:
<!-- Nastylovaný div A -->
<div onMouseOver="document.getElementByID['B'].style.display=''"
onMouseOut="document.getElementByID['B'].style.display='none'">Bla</div>
<!-- div B, taky nastylovaný, v CSS musí mít display:none -->
<div class="onpocitadlo" id="B">Bla</div>
Na to potřebuješ znalost:
getElementByID: http://www.tvorba-webu.cz/dom/getelementbyid.php
CSS vlastnost dispay: http://www.jakpsatweb.cz/css/display.html
Pokud budu mít čas, zkusím hotové řešení ;-)
Nemůžu přijít na to proč to nefunguje.
<div class="pocitadlo" onMouseOver="document.getElementByID['B'].style.display=''" onMouseOut="document.getElementByID['B'].style.display='none'">
<div class="pocitadlo2"><?php obrazkoveDatum($zob); ?></div>
<div id="B">Ahoj</div>
</div>
.pocitadlo {
border: 1px solid #000000;
background: #b4dcf8;
height: 40px;
width: 120px;
position: absolute;
left: -1px;
bottom: -1px;
z-index: 2000;
}
Prvek A
/**************************/
.pocitadlo2 {
background: #b4dcf8;
position: relative;
overflow: hidden; /* bez tohoto spadne IE7 */
left: 0px;
bottom: -8px;
text-align: center;
display: block;
}
vložený prvek v prvku A
/******************************/
#B {
position: relative;
height: 400px;
width: 400px;
border: 1px solid #000;
background: #b4dcf8;
z-index: 5555;
display: none;
}
prvek B ten se má zobrazit při najetí na prvek A

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 104 hostů
Podobná vlákna
Události onmouseover a onmouseout — založil HoHo
JQuery - předávání parametru při volání události — založil General
Spuštění obsluhy události (bez události) — založil bear.king
Google maps, zobraz data pro marker — založil Earl Cash
Moderátoři diskuze