napisałem kod:
<script> function openClose(id) { if(document.getElementById) { element = document.getElementById(id); } else if(document.all) { element = document.all[id]; } else return; if(element.style) { if(element.style.display == 'block' ) { element.style.display = 'none'; document.getElementById(id+'_clicked').style.display = 'block'; } else { element.style.display = 'block'; document.getElementById(id+'_clicked').style.display = 'none'; if(getElementsById(id).length > 1) { element.style.margin = "0 "+(70*getElementsById(id).length)+"0 0"; } } } } </script> <style> #menus { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color: orange; padding: 1px; position: absolute; left: 35%; /*margin-left: -175px;*/ z-index: 101; width: 30%; text-align: center; display: none; margin-top: 50px; } #menus .menuss { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color: black; color: silver; padding: 10px; height: 100px; } #menusss { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color: orange; padding: 1px; position: absolute; left: 35%; /*margin-left: -175px;*/ z-index: 101; width: 30%; text-align: center; display: none; margin-top: 50px; } #menusss .menuss { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color: black; color: silver; padding: 10px; height: 100px; } </style> <ul align="left" class="topnav"> </ul>
I teraz mam kilka problemów.
- Dla dwóch elementów mogłem sobie napisac klasę, ale jak to przerobić, aby klasa była jedna dla wszystkich? Bo jak będę mieć 20 takich to sobie nie dopisze 20 klas ;/
- Jak poprawnie zrobić, aby "okienka" pokazywały się jedno pod drugim? (próbowałem z 70*getElementsByTagName(id).length ale to nie działa) - teraz są jedno nad drugim i nawet nie wiem od czego zależy, które będzie na widoku... LUB jak zrobić, aby kolejny tekst po kliknięciu w "coś" następnego dodawał się do diva ?
Ktoś mi to wyjaśni?
Z góry dziękuję.
