Zoid
Zoid

Reputation: 85

Navigation transition not working correctly

Okay So my navigation is responsive and fully working, well kinda. There is just 1 small little thing that is bugging me. The nav has a transition and when you resize your viewport small than 768px the nav goes into a slide in nav but you can see the nav move since it has a transition. How can I keep the transition but remove the fact that you can clearly see the nav as you resize the viewport.

My website is up at: http://www.zoidstudios.com/

Help would be greatly appreciated :D

Upvotes: 0

Views: 42

Answers (1)

DavidDomain
DavidDomain

Reputation: 15293

You could try the following. Basically just set the margin-left on min-width: 768px to -180px and use padding-left to move the nav back to its original position. Since you are only transitioning margin-left change transition: all 0.3s ease-in-out; to transition: margin-left 0.3s ease-in-out;.

.main-navigation {
    position: fixed;
    height: 100%;
    width: 180px;
    background-color: #000;
    margin-left: -180px;
    padding-left: 0;
    transition: margin-left 0.3s ease-in-out;
    box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}


@media screen and (min-width: 768px)
    .main-navigation {
        position: fixed;
        height: 80px;
        width: 100%;
        margin-left: -180px;
        padding-left: 180px;
        background-color: transparent;
        transition: none;
        box-shadow: none;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

Upvotes: 3

Related Questions