我试过摆弄这个nav的css,但无法从右到左打开它。
.hamburger{
$width:25px;
$height:3px;
width:$width;
height:$height;
background:white;
display:block;
position:absolute;
top:50%;
left:50%;
margin-left:-$width/2;
margin-top:-$height/2;
transition:transform 200ms;
}
答案 0 :(得分:2)
更改
transform:translate3d(110px*$i,0,0);
到
transform:translate3d(-110px*$i,0,0);
在以下css代码中,从右到左打开:
.menu-open:checked~.menu-item{
transition-timing-function:cubic-bezier(0.165, 0.840, 0.440, 1.000);
@for $i from 1 through $menu-items{
&:nth-child(#{$i+2}){
transition-duration:90ms+(100ms*$i);
transform:translate3d(-110px*$i,0,0);
}
}
}
答案 1 :(得分:0)
在SCSS最后的循环中,有transform:translate3d(110px*$i,0,0);
。
.menu-open:checked~.menu-item{
transition-timing-function:cubic-bezier(0.165, 0.840, 0.440, 1.000);
@for $i from 1 through $menu-items{
&:nth-child(#{$i+2}){
transition-duration:90ms+(100ms*$i);
transform:translate3d(110px*$i,0,0);
}
}
}
将此值更改为负值,-110px
将使动画从右向左显示。但是,您需要更新一些其他CSS,我将留给您。
答案 2 :(得分:0)
您需要添加-110px才能转到右侧
.menu-open:checked~.menu-item{
transition-timing-function:cubic-bezier(0.165, 0.840, 0.440, 1.000);
@for $i from 1 through $menu-items{
&:nth-child(#{$i+2}){
transition-duration:90ms+(100ms*$i);
transform:translate3d(-110px*$i,0,0);
}
}
}
删除svg。