@charset "utf-8";
 
body {
background-color: #333;
color: #ccc;
}
 
img {
width: 100%;
height: auto;
vertical-align: bottom;
}
 
.photobox-Bk {
width: 100vw;
/* 中の写真がWindowの幅に広がる */
position: relative;
}
 
.wrap {
position: relative;
 
}
.photobox {
width: 33.33vw;
padding: 10px;
background-color: #ccc;
position: relative;
}
.p1 {
left: 10px;
}
.p2 {
left: calc(66vw - 10px);
/* 右端に出すため */
}
.p3 {
left: 40px;
}
 
.t {
opacity: 0; /*透明*/
transform: rotate(-25deg);
transition: opacity .5s linear, transform .3s linear;
}
 
.anime {
opacity: 1;
transform: rotate(0deg);
}
 
 
 
'use strict';
// マウススクロールの量に応じて、イベント処理をするプログラム
 
$(function () {
 
// 関数化して、イベントが発生した時に関数を呼び出す。
const scrollEvent = () => {
// スクロールの距離
let scroll = $(window).scrollTop();
console.log(`スクロールの距離${scroll}`);
// ウィンドウの高さを取得
let windowHeight = $(window).height();
console.log(`高さ${windowHeight}`);
 
$('.t').each(function () {
// おのおのの要素のTopを取得
let elmPos = $(this).offset().top;
console.log(elmPos);
if (scroll >= elmPos - windowHeight) {
// elmPosが、windowの中にいる時
$(this).addClass('anime');
} else {
// elmPosが、windowの外にいる時
$(this).removeClass('anime');
}
});
 
}; //scrollEvent
 
 
 
// スクロールイベントを取る
$(window).on('scroll', scrollEvent);
}); //$