Slide two divs simultaneously

前端 未结 3 629
逝去的感伤
逝去的感伤 2021-01-18 04:29

I\'m trying to have two sections in the same page, a login-section and an app-section.

The idea is onLoginSubmit() to slide out to the left the login-section and sli

3条回答
  •  生来不讨喜
    2021-01-18 05:07

    HTML

    hi
    there
    click to toggle

    CSS

    #login-section {
    background-color: green;
    }
    
    #app-section {
      background-color: blue;
      display: none;
    }
    
    #login-section, #app-section {
      position: absolute;
      width: 100%;
      top: 0px;
    }
    
    #toggle-sections {
      position: relative;
      top: 50px;
    }
    

    JQuery

    $('#toggle-sections').click(function() {
      $('#login-section').toggle("slide", { direction: "left" }, 500);
      $('#app-section').toggle("slide", { direction: "right" }, 500);
    });
    

    Demo fiddle https://jsfiddle.net/6cndzc6j/

提交回复
热议问题