- <script type="text/javascript">
- //<![CDATA[
- $(function(){
- $(window).scroll(function (){
- $('.left-to-right, .down-to-top, .right-to-left, .top-to-down').each(function(){
- var elemPos = $(this).offset().top;
- var scroll = $(window).scrollTop();
- var windowHeight = $(window).height();
- if (scroll > elemPos - windowHeight + 150){
- $(this).addClass('scrollin');
- }
- });
- });
- });
- //]]>
- </script>
- style>
- /* <![CDATA[ */
- /*左から右にフェードイン*/
- .left-to-right {
- opacity: 0.1;
- transform: translateX(-50px);
- transition: all 1s;
- }
- .left-to-right.scrollin {
- opacity: 1;
- transform: translate(0);
- }
- /*右から左にフェードイン*/
- .right-to-left {
- opacity: 0.1;
- transform: translateX(50px);
- transition: all 1s;
- }
- .right-to-left.scrollin {
- opacity: 1;
- transform: translate(0);
- }
- /*下から上にフェードイン*/
- .down-to-top {
- opacity: 0.1;
- transform: translateY(50px);
- transition: all 1s;
- }
- .down-to-top.scrollin {
- opacity: 1;
- transform: translateY(0);
- }
- /*上から下にフェードイン*/
- .top-to-down {
- opacity: 0.1;
- transform: translateY(-50px);
- transition: all 1s;
- }
- .top-to-down.scrollin {
- opacity: 1;
- transform: translateY(0);
- }
- /*]]>*/
- </style>