Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
	<div class="section ht1">
        <ul id="cardList" class="card_list">
            <li>
                <a href="javascript:void(0);" class="card_item bg3">
                    <h3 class="first">예빈이가 좋아하는 음식은?</h3>
                    <p>인스타그램에서 퍼왔어요~ <br>https://www.instagram.com/yeebeen99/</p>
                </a>
            </li>
            <li>
                <a href="javascript:void(0);" class="card_item bg4">
                    <h3 class="last">예빈이 외모 실화냐? 브이 찰칵!</h3>
                    <p>인스타그램에서 퍼왔어요~ <br>https://www.instagram.com/yeebeen99/</p>
                </a>
            </li>
        </ul>
	</div>
	<div class="section ht2">
        <ul id="cardList2" class="card_list">
            <li>
                <a href="javascript:void(0);" class="card_item bg1">
                    <h3 class="first">꽃이 이뻐 예빈이가 이뻐? :)</h3>
                    <p>인스타그램에서 퍼왔어요~ <br>https://www.instagram.com/yeebeen99/</p>
                </a>
            </li>
            <li>
                <a href="javascript:void(0);" class="card_item bg2">
                    <h3 class="last">벚꽃에서 사색중인 예빈이</h3>
                    <p>인스타그램에서 퍼왔어요~ <br>https://www.instagram.com/yeebeen99/</p>
                </a>
            </li>
        </ul>
	</div>
	<div class="section">
		<h2 class="tit">예빈나다 귀염둥이 삼춘이 응원한다~</h2>
		<p class="thumb"><img src="https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/e35/p1080x1080/90719873_240516163743998_5955046263581731777_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=102&_nc_ohc=hLdS56IR3qoAX-dRul8&oh=a155952a9e99b053e260b38440ed97dd&oe=5EC19410" alt=""></p>
	</div>
	<div class="section">
		<h2 class="tit">샤방샤방 예빈이~</h2>
		<p class="thumb"><img src="https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/s750x750/62397212_453736015463047_1796493235642147277_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=107&_nc_ohc=fM9c1188-4IAX8XBGvj&oh=93ac5e421c091d8e9e120a58501f5f1b&oe=5EC23508" alt=""></p>
	</div>
	</div>
	<div class="section">
		<h2 class="tit">예빈이는 매력적이야~</h2>
		<p class="thumb"><img src="https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/s750x750/72749535_756361784833377_7511214706664199405_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=109&_nc_ohc=wzSxhUIX6fEAX8UzeS2&oh=9bc3e6d94b5fa7cee2883e69f63eecea&oe=5EC0A9F4" alt=""></p>
	</div>
	</div>
</div>
              
            
!

CSS

              
                *{margin:0;padding:0;}
:root{font-size:62.5%;}
body{font-size:1.8rem;background:#eee;}
.tit{font-size:3rem;}
.section{height:70rem;border-bottom:2px solid #000;}
.section .tit{position:relative;top:15rem;opacity:0;
	transition:all .8s ease-in;
	-webkit-transition:all .8s ease-in;
	-moz-transition:all .8s ease-in;
}
.section .thumb{position:relative;top:30rem;opacity:0;
	transition:all .8s ease-in;
	-webkit-transition:all .8s ease-in;
	-moz-transition:all .8s ease-in;
}
.section.current .tit{top:0;opacity:1;}
.section.current .thumb{top:0;opacity:1;}
.section.ht1,.section.ht2{height:30rem !important;}
.section.ht1{background:steelblue;}
.section.ht2{background:yellowgreen;}
.thumb{width:300px;}
.thumb img{max-width:100%;}
.card_list{font-size:0;}
.card_list li{display:inline-block;width:50%;font-size:16px;vertical-align:top;}
.card_item{display:block;position:relative;height:300px;}
.card_item.bg1{background:url(https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/p640x640/91619893_220415069066027_114223739052292844_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=111&_nc_ohc=Ud9uPbX0EQIAX-HlLdF&oh=d81de3207272af3fad22bccbebc5455d&oe=5EC0C875) no-repeat 50% 50%;background-size:cover;}
.card_item.bg2{background:url(https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/p640x640/92030409_213904483271001_5654075917355010151_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=109&_nc_ohc=TtufWoklGv4AX-ugw0k&oh=1084cf04f1b5cb3ebda7a6acf84d854c&oe=5EC14D3A) no-repeat 50% 50%;background-size:cover;}
.card_item.bg3{background:url(https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/s640x640/88375954_594536301392138_4896769876647322864_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=102&_nc_ohc=Mo8tCntfEXsAX-seSz3&oh=02e180a9ed37a6f678a6efe1718f5d34&oe=5EC24C29) no-repeat 50% 50%;background-size:cover;}
.card_item.bg4{background:url(https://scontent-ssn1-1.cdninstagram.com/v/t51.2885-15/e35/s1080x1080/84345607_611048452805476_6076410040355020422_n.jpg?_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=104&_nc_ohc=gaKfSAwWOqcAX8FoBOK&oh=78d86459287c30b0bdc0c63f03f972f8&oe=5EC296E6) no-repeat 50% 50%;background-size:cover;}

.card_item h3{position:relative;height:50px;font-size:12px;opacity:0;text-align:center;color:#fff;transition:all .3s ease-in-out;}
.card_item h3.first {
	transform:translateX(-100%);
	-webkit-transition:translateX(-100%);
	-moz-transition:translateX(-100%);

	background: rgb(2,0,36);
	background: -moz-linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(161,23,140,1) 27%, rgba(0,212,255,1) 100%);
	background: -webkit-linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(161,23,140,1) 27%, rgba(0,212,255,1) 100%);
	background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(161,23,140,1) 27%, rgba(0,212,255,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#020024",endColorstr="#00d4ff",GradientType=1);
}
.card_item h3.last {
	transform:translateX(100%);
	-webkit-transition:translateX(100%);
	-moz-transition:translateX(100%);

	background: rgb(2,0,36);
	background: -moz-linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(44,117,111,1) 27%, rgba(213,232,36,1) 100%);
	background: -webkit-linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(44,117,111,1) 27%, rgba(213,232,36,1) 100%);
	background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(44,117,111,1) 27%, rgba(213,232,36,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#020024",endColorstr="#d5e824",GradientType=1);
}
.card_item h3:after{content:"";display:inline-block;height:100%;vertical-align:middle;}
.card_item p{position:absolute;left:0;bottom:0;right:0;height:50px;background:rgba(0,0,0,.7);font-size:13px;color:#fff;transition:all .3s ease-in}
.card_list li.on .card_item p{height:50%;}
.card_list li.on .card_item h3{
	opacity:1;
	transform:translateX(0);
	-webkit-transition:translateX(0);
	-moz-transition:translateX(0);
}
@media all and (max-width:480px){
	.thumb{width:100%}
}
              
            
!

JS

              
                var $win = $(window),
    $doc = $(document),
    $html = $('html'),
    $body = $('body');

var viewMode,
    resizeTimer = null;

var sectionAni = function(className){        
    var hitArea = [];
    var timer = null;    

    $('.'+ className ).each(function(){
        hitArea.push( $(this).offset().top );

        $win.scroll(function(){
            clearTimeout(timer);
            timer = setTimeout(function(){
                var hitTop = $win.scrollTop() + $win.height() - 50;

                $.each(hitArea, function(index, item){

                    if( hitTop >= hitArea[index] ){
                        $('.'+ className).eq(index).addClass('current');
                    }else{
                        $('.'+ className).eq(index).removeClass('current');
                    }
                });
            }, 10);
        });
        $win.trigger('scroll');
    });
};
var cardRollOver = function(idName){
	$('#'+ idName).find('a').bind({
        'focusin': function(){
            if(viewMode == 'm'){
                $(this).parent('li').addClass('on');
            }else{
                return;
            }
        },
        'focusout': function(){
            if(viewMode == 'm'){
                $(this).parent('li').removeClass('on');
            }else{
                return;
            }
        }
	});
    $('#'+ idName).find('a').bind({
        'mouseenter': function(){
            if(viewMode == 't' || viewMode == 'p'){
                $(this).parent('li').addClass('on');
            }else{
                return;
            }
        },
        'mouseleave': function(){
            if(viewMode == 't' || viewMode == 'p'){
                $(this).parent('li').removeClass('on');
            }else{
                return;
            }
        }
    });
};

$(document).ready(function(){
	sectionAni('section');
	cardRollOver('cardList');
	cardRollOver('cardList2');
	checkViewMode();

	$win.resize(function(){
		clearTimeout(resizeTimer);
		resizeTimer = setTimeout(checkViewMode,100);
	});
});

/*
* checkViewMode
* @func
* return 'm' (모바일) , 't' (태블릿), 'p' (데스크탑) 
* if(viewMode == 'm'){ 조건문으로 사용
*/
function checkViewMode(){
    if ($win.width() < 641){
        viewMode = 'm'	//mobile
    } else if ($win.width() < 1025){
        viewMode = 't'	//tablet
    } else {
        viewMode = 'p'	//PC
    }
    console.log(viewMode);
}
              
            
!
999px

Console