Как настроить раскрывающийся список в соответствии с размером экрана, чтобы раскрывающийся список не выходил за пределы экрана - PullRequest
0 голосов
/ 25 января 2019

[введите описание ссылки здесь] [1] Я работаю над проектом в этом проекте, мне нужно выпадающее меню, которое не выходит за пределы экрана в адаптивном режиме. в режиме рабочего стола раскрывающийся список отображается правильно, но в мобильном режиме раскрывающийся список выходит за пределы экрана, поэтому раскрывающийся список отображается неправильно.

вот ссылка js fiddle для этого кода

#crm-progress-status .opaque {
    opacity: 0;
    transition: 0.3s ease;
}

.crm-button-container .disabled {
    opacity: 0.4;
    pointer-events: none;
}

#crm-progress-status {
    width: 90%;
    margin: 0px auto;
    font-size: 14px;
    font-weight: 300;
    position: relative;
}

@media (max-width: 767px) {
    #crm-progress-status {
        font-size: 12px;
    }
}

#crm-progress-status:before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    height: 3px;
    width: 100%;
    background-color: #ccc;
    -webkit-transform: translateY(-50%) perspective(1000px);
    transform: translateY(-50%) perspective(1000px);
}

#crm-progress-status:after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    height: 3px;
    width: 100%;
    background-color: #FF4D4D;
    -webkit-transform: scaleX(0) translateY(-50%) perspective(1000px);
    transform: scaleX(0) translateY(-50%) perspective(1000px);
    -webkit-transform-origin: left center;
    transform-origin: left center;
    transition: -webkit-transform 0.5s ease;
    transition: transform 0.5s ease;
    transition: transform 0.5s ease, -webkit-transform 0.5s ease;
}

#crm-progress-status.step-2:after {
    -webkit-transform: scaleX(0.333) translateY(-50%) perspective(1000px);
    transform: scaleX(0.333) translateY(-50%) perspective(1000px);
}

#crm-progress-status.step-3:after {
    -webkit-transform: scaleX(0.666) translateY(-50%) perspective(1000px);
    transform: scaleX(0.666) translateY(-50%) perspective(1000px);
}

#crm-progress-status.step-4:after {
    -webkit-transform: scaleX(1) translateY(-50%) perspective(1000px);
    transform: scaleX(1) translateY(-50%) perspective(1000px);
}

#crm-progress-status.step-5:after {
    -webkit-transform: scaleX(1) translateY(-50%) perspective(1000px);
    transform: scaleX(1) translateY(-50%) perspective(1000px);
}

#crm-progress-status .crm-progress-status {
    width: 100%;
    display: flex;
    height: 50px;
    justify-content: space-between;
    align-items: center;
}

#crm-progress-status .crm-progress-status .step {
    z-index: 2;
    position: relative;
}

#crm-progress-status .crm-progress-status .step .step-label {
    position: absolute;
    top: calc(100% + 0px);
    left: 50%;
    -webkit-transform: translateX(-50%) perspective(1000px);
    transform: translateX(-50%) perspective(1000px);
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
    transition: 0.3s ease;
}

@media (max-width: 767px) {
    #crm-progress-status .crm-progress-status .step .step-label {
        top: calc(100% + 0);
    }
}

#crm-progress-status .crm-progress-status .step span {
    color: #ccc;
    transition: 0.3s ease;
    display: block;
    -webkit-transform: translate3d(0, 0, 0) scale(1) perspective(1000px);
    transform: translate3d(0, 0, 0) scale(1) perspective(1000px);
}

#crm-progress-status .crm-progress-status .step .fa-check {
    color: #fff;
    position: absolute;
    left: 50%;
    top: 50%;
    transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
    transition: transform 0.3s ease, -webkit-transform 0.3s ease;
    -webkit-transform: translate3d(-50%, -50%, 0) scale(0) perspective(1000px);
    transform: translate3d(-50%, -50%, 0) scale(0) perspective(1000px);
}

#crm-progress-status .crm-progress-status .step.active span, #crm-progress-status .progress-bar .step.active .step-label {
    color: #FF4D4D;
}

#crm-progress-status .crm-progress-status .step.valid .fa-check {
    -webkit-transform: translate3d(-50%, -50%, 0) scale(1) perspective(1000px);
    transform: translate3d(-50%, -50%, 0) scale(1) perspective(1000px);
}

#crm-progress-status .crm-progress-status .step.valid span {
    color: #FF4D4D;
    -webkit-transform: translate3d(0, 0, 0) scale(2) perspective(1000px);
    transform: translate3d(0, 0, 0) scale(2) perspective(1000px);
}

#crm-progress-status .crm-progress-status .step.valid .step-label {
    color: #FF4D4D !important;
}

#crm-progress-status .crm-progress-status .step:after {
    content: "\f00c";
    position: absolute;
    z-index: -1;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%) perspective(1000px);
    transform: translate(-50%, -50%) perspective(1000px);
    width: 25px;
    height: 25px;
    background-color: #fff;
    border-radius: 50%;
    border: 2px solid #ccc;
    transition: 0.3s ease;
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
}

@media (max-width: 767px) {
    #crm-progress-status .crm-progress-status .step:after {
        width: 25px;
        height: 25px;
    }
}

#crm-progress-status .crm-progress-status .step.active:after {
    border: 2px solid #FF4D4D;
}

#crm-progress-status .crm-progress-status .step.valid:after {
    background-color: #FF4D4D;
    border: 2px solid #FF4D4D;
}

.crm-button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    width: 100%;
    margin: 0 0 5px 0;
}

.crm-button-container .btn {
    display: inline-block;
    color: #000;
    padding: 0;
    text-transform: uppercase;
    font-weight: 500;
    transition: 0.3s ease;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
}

@media (max-width: 767px) {
    .crm-button-container .btn {
        width: 100%;
        margin-bottom: 15px;
    }
}

.crm-button-container .btn:hover {
    background-color: transparent;
    color: #FF4D4D;
}

.crm-status-drop {
    position: relative;
    font-size: 1em;
    cursor: pointer;
}

.crm-status-drop a {
    font-weight: 400;
    line-height: 2.5em;
    padding: 0 1em;
    color: #4d4d4d;
    text-decoration: none;
}

.crm-status-drop .triangle {
    width: 0;
    height: 0;
    position: absolute;
    border-left: .4em solid transparent;
    border-right: .4em solid transparent;
    border-top: .4em solid #FFB135;
    left: 89.5%;
    margin-left: -.4em;
    opacity: 0;
}

.crm-dropdownContain {
    width: auto;
    position: absolute;
    z-index: 2;
    left: 50%;
    margin-left: -6.5em;
    /* half of width */
    top: -500px;
}

.crm-dropdownContain .dropOut {
    width: auto;
    background: #f6f6f6;
    float: left;
    position: relative;
    margin-top: 0;
    opacity: 0;
    -moz-border-radius: 0.4em / 0.4em;
    -webkit-border-radius: 0.4em 0.4em;
    border-radius: 0.4em / 0.4em;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.75);
    overflow: hidden;
    -webkit-transition: all 0.1s ease-out;
    -moz-transition: all 0.1s ease-out;
    -ms-transition: all 0.1s ease-out;
    -o-transition: all 0.1s ease-out;
    transition: all 0.1s ease-out;
}

.crm-dropdownContain .dropOut ul {
    padding: .3em 0;
    margin: 0;
}

.crm-dropdownContain .dropOut li {
    text-align: left;
    width: 100%;
    padding: 5px;
    color: gray;
    -webkit-transition: all 0.1s ease-out;
    -moz-transition: all 0.1s ease-out;
    -ms-transition: all 0.1s ease-out;
    -o-transition: all 0.1s ease-out;
    transition: all 0.1s ease-out;
    display: flex;
}

.crm-dropdownContain .dropOut li span {
    color: #cccccc;
    margin: 0 1.5em 0 .8em;
}

.crm-dropdownContain .dropOut li:hover {
    color: #4d4d4d;
    background: #ededed;
}

.crm-dropdownContain .dropOut li:hover span {
    color: gray;
}

.crm-status-drop:hover .crm-dropdownContain {
    top: 10px;
}

.crm-status-drop:hover .dropOut {
    opacity: 1;
    margin-top: 20px;
}

.crm-dropdownContain h5 {
    font-size: 14px;
    padding: 5px;
    margin-bottom: 0;   
}

.crm-dropdownContain hr {
    margin: 0;
}

.crm-status-drop .form-check-input {
    margin-top: 3px;
    margin-left: -16px;
}
  <div class="col-md-6">

                                    <div class="step-1" id="crm-progress-status" data-current-step="1">
                                            <div class="crm-progress-status">
                                              <div class="step step-1 active"><span> 1</span>

                                                <div class="crm-status-drop step-label">

                                                    <a href="#">SetUp</a>
                                                   
                                                    <div class="crm-dropdownContain">
                                                    <div class="dropOut">
                                                        <ul>
                                                              <h5>Active For 5 Days</h5>
                                                              <hr />
                                                              <li> Number Of Ideas: <span>5</span></li>
                                                              <hr />
                                                              <li> Last Update: <span>3/12/2019 5.25PM</span></li>
                                                              <hr />
                                                              <li> Announce Voting:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Complate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                              <li> Close Challange to new idea:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Incomplate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                        </ul>
                                                        <div class="crm-button-container">
                                                                <div class="btn btn-prev disabled"> previous step</div>
                                                                <div class="btn btn-next"> next step</div>
                                                        </div>
                                                    </div>
                                                    </div>

                                                  

                                                </div>

                                              </div>

                                              <div class="step step-2"><span> 2</span>

                                                <div class="crm-status-drop step-label">

                                                    <a href="#">Track (5 Day)</a>
                                                   
                                                    <div class="crm-dropdownContain">
                                                    <div class="dropOut">
                                                        <ul>
                                                              <h5>Active For 5 Days</h5>
                                                              <hr />
                                                              <li> Number Of Ideas: <span>5</span></li>
                                                              <hr />
                                                              <li> Last Update: <span>3/12/2019 5.25PM</span></li>
                                                              <hr />
                                                              <li> Announce Voting:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Complate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                              <li> Close Challange to new idea:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Incomplate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                        </ul>
                                                        <div class="crm-button-container">
                                                                <div class="btn btn-prev disabled"> previous step</div>
                                                                <div class="btn btn-next"> next step</div>
                                                        </div>
                                                    </div>
                                                    </div>

                                                  

                                                </div>

                                              </div>

                                              <div class="step step-3"><span> 3</span>

                                                <div class="crm-status-drop step-label">

                                                    <a href="#">Select And Execute</a>
                                                   
                                                    <div class="crm-dropdownContain">
                                                    <div class="dropOut">
                                                        <ul>
                                                              <h5>Active For 5 Days</h5>
                                                              <hr />
                                                              <li> Number Of Ideas: <span>5</span></li>
                                                              <hr />
                                                              <li> Last Update: <span>3/12/2019 5.25PM</span></li>
                                                              <hr />
                                                              <li> Announce Voting:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Complate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                              <li> Close Challange to new idea:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Incomplate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                        </ul>
                                                        <div class="crm-button-container">
                                                                <div class="btn btn-prev disabled"> previous step</div>
                                                                <div class="btn btn-next"> next step</div>
                                                        </div>
                                                    </div>
                                                    </div>

                                                  

                                                </div>

                                              </div>

                                              <div class="step step-4"><span> 4</span>

                                                <div class="crm-status-drop step-label">

                                                    <a href="#">Close And Award</a>
                                                   
                                                    <div class="crm-dropdownContain">
                                                    <div class="dropOut">
                                                        <ul>
                                                              <h5>Active For 5 Days</h5>
                                                              <hr />
                                                              <li> Number Of Ideas: <span>5</span></li>
                                                              <hr />
                                                              <li> Last Update: <span>3/12/2019 5.25PM</span></li>
                                                              <hr />
                                                              <li> Announce Voting:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Complate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                              <li> Close Challange to new idea:
                                                                <div class="form-check">
                                                                    <label class="form-check-label">
                                                                      <input type="checkbox" class="form-check-input" value="">Incomplate
                                                                    </label>
                                                                </div>
                                                              </li>
                                                              <hr />
                                                        </ul>
                                                        <div class="crm-button-container">
                                                                <div class="btn btn-prev disabled"> previous step</div>
                                                                <div class="btn btn-next"> next step</div>
                                                        </div>
                                                    </div>
                                                    </div>

                                                  

                                                </div>

                                              </div>

                                            </div>
                                    </div>
                                         
                                        
                            </div>

https://jsfiddle.net/35nfck16/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...