Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]Odsuwanie innych divów po rozsunięciu menu
AlKhalif
post 31.08.2016, 12:11:48
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 9.08.2016

Ostrzeżenie: (0%)
-----


mam taki oto kod:
Kod
<div id="mainContainer">
  <div id="menu1" class="menu">
    <input type="button" id="button1" value="Menu">
    
    <?php
            include('loginbox.php');
    ?>
    
    <div id="menu2" class="menu">
      <p>
      Link
      </p>
         <p>
      Link
      </p>
      <p>
      Link
      </p>
    </div>
  </div>

</div>
<script src="jquery-2.2.4.js"></script>
<script>
    $(document).ready(function() {
  $menu1 = $("#menu1");
  $menu2 = $("#menu2");

  $menu2.hide();
  $folded = true;

  $("#button1").click(function() {
    if ($folded) {
      $menu1.animate({
        height: '300px'
      });
      $folded = false;
    } else {
      $menu1.animate({
        height: '40px'
      });
      $folded = true;
    }
    $menu2.toggle();
  });


});
</script>
<main> </main>

Niestety po rozsunięciu menu zakrywa mi część main.
Wie ktoś jak to zrobić abu odsunęło te divy niżej aby ich nie zasłaniać?

Ten post edytował AlKhalif 31.08.2016, 12:12:23
Go to the top of the page
+Quote Post
Puszy
post 31.08.2016, 12:20:50
Post #2





Grupa: Zarejestrowani
Postów: 279
Pomógł: 42
Dołączył: 10.10.2011

Ostrzeżenie: (0%)
-----


Bez CSSa nie zasłania <main>, sprawdź style.
Go to the top of the page
+Quote Post
AlKhalif
post 31.08.2016, 12:41:37
Post #3





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 9.08.2016

Ostrzeżenie: (0%)
-----


Nie wiem co jest źle. Podaje tutaj cały CSS
Kod
body {
    height: 100%;
    width: 100%;
    background-image: url(images/desk.jpg);
    margin: 0;
    padding: 0;
    font-family: Verdana;
}
#all
{
    width:1000px;
    height:100%;
    margin:auto;
}
#login
{
    float: right;
}
#logo
{
    width: 1000px;
    height: 150px;
    margin-top: 40px;
    background-color: #ddd;
    box-shadow: 0 0 16px black;
    border-radius: 8px;
}
main
{
    width: 1000px;
    height: 800px;
    margin-top: 10px;
    background-color: #ddd;
    box-shadow: 0 0 16px black;
    border-radius: 8px;
}
footer
{
    width: 1000px;
    height: 80px;
    margin-top: 10px;
    margin-bottom: 40px;
    background-color: #ddd;
    box-shadow: 0 0 16px black;
    border-radius: 8px;
}
#login_button
{
    background-color: #944;
    width: 180px;
    text-align: center;
    color: #fff;
    padding: 3px;
    border-radius: 6px;
    margin-left:14px;
    margin-right:14px;
    text-decoration: none;
    display: inline;
}
#loginbox
{
    padding: 4px;
    padding-right: 0px;
    text-align: right;
    float:right;
}
#login a
{
    text-decoration:none;
}
#ad
{
    width: 1000px;
    height: 150px;
    margin-top: 10px;
    background-color: #ddd;
    box-shadow: 0 0 16px black;
    border-radius: 8px;
}
#devconsole
{
    z-index: 2;
    margin: auto;
    width: 800px;
    height: 400px;
    background-color: black;
    color: white;
    border: 2px solid white;
    border-radius: 10px;
}
#zarejestrowano
{
    z-index: 2;
    width: 400px;
    height: 100px;
    background-color: ddd;
    color: black;
    border: 2px solid white;
    border-radius: 10px;
    text-align: center;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -200px; /* połowa szerokości */
    margin-top: -50px;
    vertical-align: middle;
    box-shadow:0 0 16000px black;
    text-decoration: none;
    
}
#zarejestrowano a
{
    text-decoration:none;
}
#registerform
{
    float: left;
    width: 380px;
    height:500px;
    background-image: url(images/mbg.jpg);
    border-radius: 20px;
    margin: 30px;
    padding: 30px;
}
#regulamin
{
    float: right;
    width: 380px;
    height:680px;
    background-image: url(images/mbg.jpg);
    border-radius: 20px;
    margin: 30px;
    padding: 30px;
}
#mainContainer {
    width: 1000px;
    height: 30px;
    background-color: #ddd;
    border-radius: 8px;
    text-align: right;
    margin-top: 10px;
    margin-bottom: 20px;
}

.menu {
    width: 1000px;
    text-align: left;
    float: left;
}

#menu1 {
    height: 40px;
    width: 1000px;
    background-color: #ddd;
    border-radius: 8px;
}
#menu2{
    width: 1000px;
    height: 430px;
    margin-top: 30px;
    border-radius: 8px;
    border: 2px solid black;
}





PS: zauważyłem że treść jest dosuwana, ale zakrywa ten div main. Jak zrobić aby cały main też sie odsuwał?

Ten post edytował AlKhalif 31.08.2016, 12:43:48
Go to the top of the page
+Quote Post
Puszy
post 31.08.2016, 12:48:56
Post #4





Grupa: Zarejestrowani
Postów: 279
Pomógł: 42
Dołączył: 10.10.2011

Ostrzeżenie: (0%)
-----


U mnie wygląda to tak: https://zapodaj.net/98a14c3745ca0.png.html

Go to the top of the page
+Quote Post
AlKhalif
post 31.08.2016, 13:02:02
Post #5





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 9.08.2016

Ostrzeżenie: (0%)
-----


no i jest źle, bo odsuwa treść, ale i tak zakrywa pole niżej

udało się. Wstawiłem przed main zakodowaną spacje i teraz przesuwa cały main
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.07.2025 - 19:16