Skip to content

Commit

Permalink
Fixed issue SidebarJS#7
Browse files Browse the repository at this point in the history
  • Loading branch information
omelsoft committed Mar 7, 2019
1 parent 24daf48 commit 75bd786
Show file tree
Hide file tree
Showing 4 changed files with 518 additions and 402 deletions.
178 changes: 116 additions & 62 deletions dist/angular-sidebarjs.css
Original file line number Diff line number Diff line change
@@ -1,76 +1,130 @@
[sidebarjs-backdrop], [sidebarjs] {
top: 0;
left: 0;
width: 100%;
height: 100%; }
[sidebarjs-backdrop],
[sidebarjs] {
top: 0;
left: 0;
width: 100%;
height: 100%;
}

[sidebarjs].sidebarjs--left, [sidebarjs].sidebarjs--left [sidebarjs-container] {
-webkit-transform: translate(-100%, 0);
transform: translate(-100%, 0); }
.sidebarjs--left[sidebarjs],
[sidebarjs].sidebarjs--left [sidebarjs-container] {
transform: translate(-100%, 0);
}

[sidebarjs].sidebarjs--right, [sidebarjs].sidebarjs--right [sidebarjs-container] {
-webkit-transform: translate(100%, 0);
transform: translate(100%, 0); }
.sidebarjs--right[sidebarjs],
[sidebarjs].sidebarjs--right [sidebarjs-container] {
transform: translate(100%, 0);
}

[sidebarjs].sidebarjs--left [sidebarjs-container] {
-webkit-box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2);
box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2); }
box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2);
}

[sidebarjs].sidebarjs--right [sidebarjs-container] {
-webkit-box-shadow: -2px 0 4px rgba(0, 0, 0, 0.2);
box-shadow: -2px 0 4px rgba(0, 0, 0, 0.2);
margin-left: auto; }
box-shadow: -2px 0 4px rgba(0, 0, 0, 0.2);
margin-left: auto;
}

[sidebarjs-backdrop] {
position: absolute;
background: #000;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
will-change: opacity; }
position: absolute;
background: #000;
opacity: 0;
transition: opacity 0.3s ease;
will-change: opacity;
}

[sidebarjs-container] {
position: relative;
z-index: 1;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
width: 90%;
max-width: 300px;
height: 100%;
background: #fff;
-webkit-transition: -webkit-transform ease 0.3s;
transition: -webkit-transform ease 0.3s;
transition: transform ease 0.3s;
transition: transform ease 0.3s, -webkit-transform ease 0.3s;
will-change: transform; }
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
width: 90%;
max-width: 300px;
height: 100%;
background: #fff;
transition: transform ease 0.3s;
will-change: transform;
}

[sidebarjs] {
position: fixed;
z-index: 9999;
-webkit-transition: -webkit-transform 0s ease 0.3s;
transition: -webkit-transform 0s ease 0.3s;
transition: transform 0s ease 0.3s;
transition: transform 0s ease 0.3s, -webkit-transform 0s ease 0.3s; }
[sidebarjs].sidebarjs--is-visible {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
-webkit-transition: -webkit-transform 0s ease 0s;
transition: -webkit-transform 0s ease 0s;
position: fixed;
z-index: 9999;
transition: transform 0s ease 0.3s;
}

[sidebarjs].sidebarjs--is-visible {
transform: translate(0, 0);
transition: transform 0s ease 0s;
transition: transform 0s ease 0s, -webkit-transform 0s ease 0s; }
[sidebarjs].sidebarjs--is-visible [sidebarjs-container] {
-webkit-transform: translate(0, 0);
transform: translate(0, 0); }
[sidebarjs].sidebarjs--is-moving {
-webkit-transition: none;
}

[sidebarjs].sidebarjs--is-visible [sidebarjs-container] {
transform: translate(0, 0);
}

[sidebarjs].sidebarjs--is-moving {
transition: none;
-webkit-transform: translate(0, 0);
transform: translate(0, 0); }
[sidebarjs].sidebarjs--is-moving [sidebarjs-container], [sidebarjs].sidebarjs--is-moving [sidebarjs-backdrop] {
-webkit-transition: none;
transition: none; }
transform: translate(0, 0);
}

[sidebarjs].sidebarjs--is-moving [sidebarjs-container] {

This comment has been minimized.

Copy link
@omelsoft

omelsoft Mar 7, 2019

Author Owner

This is generated when updating the sidebarjs.scss file and compiled the css.

Added the following in the --is-moving class:

[sidebarjs-container] {
            transform: none!important;
        }

in the following.

[sidebarjs] {
    @extend %component--full-screen;
    position: fixed;
    z-index: 9999;
    transition: transform 0s $timing $duration;
    &.sidebarjs--is-visible {
        @include component--is-visible;
    }
    &.sidebarjs--is-moving {
        transition: none;
        transform: translate(0, 0);
        **[sidebarjs-container] {
            transform: none!important;
        }**
        [sidebarjs-container],
        [sidebarjs-backdrop] {
            transition: none;
        }
    }
}

The issue is that everytime the user moves up and down the transform property always gets updated. That's the reason of the flickering issue. To fix that, I added an override to force the transform to none.

transform: none !important;
}

[sidebarjs].sidebarjs--is-moving [sidebarjs-container],
[sidebarjs].sidebarjs--is-moving [sidebarjs-backdrop] {
transition: none;
}

[sidebarjs-content] {
position: relative;
width: 100%;
min-height: 100%;
transition: width 0.3s ease;
}

[sidebarjs-content].sidebarjs-content--left {
margin-left: auto;
margin-right: 0;
}

[sidebarjs-content].sidebarjs-content--right {
margin-left: 0;
margin-right: auto;
}

@media (min-width: 1025px) {
[sidebarjs].sidebarjs--responsive {
transform: translate(0, 0) !important;
transition: transform 0s ease 0s;
width: 300px;
}
[sidebarjs].sidebarjs--responsive [sidebarjs-container] {
transform: translate(0, 0) !important;
}
[sidebarjs].sidebarjs--responsive.sidebarjs--left {
left: 0;
right: auto;
}
[sidebarjs].sidebarjs--responsive.sidebarjs--left [sidebarjs-container] {
box-shadow: 1px 0 0 rgba(0, 0, 0, 0.1);
}
[sidebarjs].sidebarjs--responsive.sidebarjs--right {
right: 0;
left: auto;
}
[sidebarjs].sidebarjs--responsive.sidebarjs--right [sidebarjs-container] {
box-shadow: -1px 0 0 rgba(0, 0, 0, 0.1);
}
[sidebarjs].sidebarjs--responsive [sidebarjs-container] {
max-width: none;
width: 100%;
box-shadow: none;
}
[sidebarjs-content] {
width: calc(100% - 300px);
}
[sidebarjs-content].sidebarjs-content--left.sidebarjs-content--right {
width: calc(100% - 600px);
margin: 0 auto;
}
}
Loading

0 comments on commit 75bd786

Please sign in to comment.