今日の積み上げ 168日目 成果
\宣言した内容はこちらです/
あわせて読みたい
【プログラミング・Web制作勉強ログ#0】宣言します(9月6日更新:開業しましたので、立ち上げた想いを…
こんにちは!こちらのページに、プログラミングを勉強した経緯や、立ち上げた仕事の概要や想いを綴っています。ぜひご覧ください。
本日の学び
アニメーション:main(FV)画面のスライダーまで。
ヘッダーのナビゲーションメニューの文字色変えは、下記のとおりのコーディングになりました。
< header class = " header" >
< div class = " container" >
< a href = " #" >
< div class = " header_title" > 株式会社北村建設興業</ div>
</ a>
< div id = " nav-open" class = " pc-none" >
< span> </ span>
</ div>
< div id = " nav-content" class = " sp-none" >
< nav class = " header-nav" >
< ul class = " nav-list" >
< li> < a href = " #about" > ABOUT</ a> </ li>
< li> < a href = " #service" > SERVICE</ a> </ li>
< li> < a href = " #works" > WORKS</ a> </ li>
< li> < a href = " #info" > NEWS</ a> </ li>
< li> < a href = " #company" > COMPANY</ a> </ li>
< li> < a href = " #contact" > CONTACT</ a> </ li>
</ ul>
</ nav>
</ div>
</ div>
< div id = " hamburger-bg" class = " hamburger-bg" > </ div>
</ header>
.header {
width : 100%;
height : 80px;
position : fixed;
font-weight : light;
z-index : 999;
.container {
display : flex;
justify-content : space-between;
white-space : nowrap;
align-items : center;
height : 80px;
.header_title {
color : $white ;
font-size : 2rem;
@include mq ( md) {
margin-left : 20px;
}
@include mq ( sp) {
position : absolute;
top : 0;
padding-top : 13px;
}
}
.header-nav ul {
display : flex;
gap : 30px;
@include mq ( md) {
gap : 10px;
margin-right : 20px;
}
@include mq ( sp) {
flex-direction : column;
gap : 0;
margin-right : 0;
}
li a {
color : $white ;
font-size : 1.8rem;
position : relative;
display : inline-block;
@include mq ( sp) {
display : block;
padding-left : 20px;
line-height : 58px;
}
& :hover {
opacity : 0.7;
& ::after {
transform : scale ( 1, 1) ;
}
@include mq ( sp) {
opacity : 1;
background-color : #000;
transition : all 1.5s;
}
}
& :after {
position : absolute;
bottom : -4px;
left : 0;
content : '' ;
width : 100%;
height : 1px;
background : rgba ( $color : $white , $alpha : 0.7) ;
transform : scale ( 0, 1) ;
transform-origin : center;
transition : transform .7s;
@include mq ( sp) {
content : none;
}
}
& .active:after {
background : rgba ( $color : #000, $alpha : 0.7) ;
}
}
}
@include mq ( sp) {
#nav-open {
background : $white ;
width : 72px;
height : 50px;
position : fixed;
right : 0;
top : 0;
padding : 13px 20px;
z-index : 9999;
}
#nav-open span, #nav-open span:before, #nav-open span:after {
position : absolute;
transition : all .7s;
height : 4px;
width : 35px;
border-radius : 2px;
background : $mainColor ;
display : block;
content : '' ;
cursor : pointer;
z-index : 9999;
}
#nav-open span:before {
bottom : -10px;
}
#nav-open span:after {
bottom : -20px;
}
#nav-open.active span {
-webkit-transform : translateY ( 12px) rotate ( -135deg) ;
transform : translateY ( 12px) rotate ( -135deg) ;
}
#nav-open.active span:before {
-webkit-transform : translateY ( -8px) rotate ( 135deg) ;
transform : translateY ( -8px) rotate ( 135deg) ;
opacity : 0;
}
#nav-open.active span:after {
-webkit-transform : translateY ( -20px) rotate ( 135deg) ;
transform : translateY ( -20px) rotate ( 90deg) ;
}
#nav-content {
display : block;
position : fixed;
z-index : 9999;
top : 50px;
right : -100%;
width : 100%;
height : 348px;
background : $mainColor ;
transition : all .7s;
}
#nav-content.open {
display : block;
right : 0;
width : 300px;
height : 348px;
}
.hamburger-bg {
-webkit-transition : all .7s;
transition : all .7s;
}
.hamburger-bg.active {
width : 100vw;
height : 100vh;
background : $mainColor ;
opacity : .7;
}
}
}
}
const sliderHeight = $ ( '.main' ) . height ( ) ;
if ( window. matchMedia ( '(max-width: 768px)' ) . matches) {
$ ( document) . scroll ( function ( ) {
if ( sliderHeight - 30 < $ ( this ) . scrollTop ( ) ) {
$ ( '.header_title' ) . css ( 'color' , '#000' ) ;
} else {
$ ( '.header_title' ) . css ( 'color' , '#fff' ) ;
} ;
} ) ;
} else if ( window. matchMedia ( '(min-width:769px)' ) . matches) {
$ ( document) . scroll ( function ( ) {
if ( sliderHeight - 50 < $ ( this ) . scrollTop ( ) ) {
$ ( '.header' ) . css ( 'background-color' , 'rgba(255,255,255,0.5)' ) ;
$ ( '.header_title' ) . css ( 'color' , '#000' ) ;
$ ( '.header-nav ul li a' ) . css ( 'color' , '#000' ) ;
$ ( '.header-nav ul li a' ) . addClass ( 'active' ) ;
} else {
$ ( '.header' ) . css ( 'background-color' , 'unset' ) ;
$ ( '.header_title' ) . css ( 'color' , '#fff' ) ;
$ ( '.header-nav ul li a' ) . css ( 'color' , '#fff' ) ;
$ ( '.header-nav ul li a' ) . removeClass ( 'active' ) ;
}
} ) ;
} ;
しかしながら、mainエリアの画像を+2枚挿入し、スライダー機能を実装したとたん、色が変わる位置がずれるエラー発生 。
おそらく、追加した画像の大きさの分トリガーの位置がズレているような気がします 。とりあえず「終わらせる」ということを優先するため、このエラー致命的なエラーではないためスキップして次へ次へ・・とコーディングしています。
本日の反省
仕事のイメトレをしています。
学習ばっかりしていると、学習が目的になってしまいそうになるため、「仕事をする場面」をイメトレするようにしています。
そのためよく見ている動画はこれです。
VIDEO
WEB制作の仕事の流れをここまで細かく説明し、かつ各ステップのあらゆる疑問にまですべて回答している動画はこれ以外ない笑
「仕事の流れ」を把握していると、「学習の意味」を感じ続けられるので、学習で躓いているところとか、ぶち当たっている「壁」に打ちのめされず、続けることができる。
引き続き頑張るぞ~!
今日も諦めなかった自分、お疲れ様でした!
Twitterでも勉強ログを呟いています。よかったら覗いてみてください♪
コメント