cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <nav id="dot">
	<ul>
		<li class="active"><a href="#c"></a></li>
		<li><a href="#c"></a></li>
		<li><a href="#c"></a></li>
		<li><a href="#c"></a></li>
		<li><a href="#c"></a></li>
		<li><a href="#c"></a></li>
	</ul>
</nav>

<section id="contents">
	<div id="section1">
		<div class="container">
			<div class="sec1">
				<h2>Just Once</h2>
			</div>
		</div>
	</div>
	<div id="section2">
		<div class="container">
			<div class="sec2">
				<h2>Without me</h2>
			</div>
		</div>
	</div>
	<div id="section3">
		<div class="container">
			<div class="sec3">
				<h2>How am i suppose to live without you</h2>
			</div>
		</div>
	</div>
	<div id="section4">
		<div class="container">
			<div class="sec4">
				<h2>Whatever you do</h2>
			</div>
		</div>
	</div>
	<div id="section5">
		<div class="container">
			<div class="sec5">
				<h2>Crush on you</h2>
			</div>
		</div>
	</div>
	<div id="section6">
		<div class="container">
			<div class="sec6">
				<h2>Don't look back in anger</h2>
			</div>
		</div>
	</div>
</section>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Electrolize');
/* reset */
*{margin:0; padding:0}
li,ul {list-style:none}
a {text-decoration:none}
body {font-family: 'Electrolize', sans-serif;}

/* nav */
#dot {position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index:1000;}
#dot li {}
#dot li a {position: relative; width: 15px; height: 15px; background-color: rgba(255,255,255,0.5); border-radius: 15px; margin: 8px; display: block;}
#dot li.active a {position: relative; background-color: rgba(255,255,255,1);}

/* dot style */
#dot li a {
	background-color: transparent;
	box-shadow: inset 0 0 0 2px white;
	-webkit-transition: background 0.3s ease;
	transition: background 0.3s ease;
}

#dot li a::after {
	content: '';
	position: absolute;
	bottom: 0;
	height: 0;
	left: 0;
	width: 100%;
	background-color: #fff;
	box-shadow: 0 0 1px #fff;
	-webkit-transition: height 0.3s ease;
	transition: height 0.3s ease;
}

#dot li a:hover {
	background-color: rgba(255,255,255,0.4);
}

#dot li.current a::after {
	height: 100%;
}

/* contents */
#contents {
	font-size: 60px; 
	color:#fff; 
	text-align: center;
}
#contents > div {
	height: 100vh; line-height: 100vh;
	position: relative;
}
/* section */
#section1 {background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);}
#section2 {background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%);}
#section3 {background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);}
#section4 {background-image: linear-gradient(to top, #5ee7df 0%, #b490ca 100%);}
#section5 {background-image: linear-gradient(to top, #96fbc4 0%, #f9f586 100%);}
#section6 {background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);}

#contents #section1 h2 {opacity:0; transition: all 0.75s ease-in-out; transform: translate3d(0,0,0)}
#contents #section2 h2 {opacity:0; transition: all 0.75s ease-in-out; transform: translate3d(0,-10%,0)}
#contents #section3 h2 {opacity:0; transition: all 0.75s ease-in-out; transform: translate3d(-10%,0,0)}
#contents #section4 h2 {opacity:0; transition: all 0.75s ease-in-out; transform: translate3d(10%,0,0)}
#contents #section5 h2 {opacity:0; transition: all 0.75s ease-in-out; transform: translate3d(0,10%,0)}
#contents #section6 h2 {opacity:0; transition: all 0.75s ease-in-out; transform: skew(90deg)}

#contents #section1.show h2 {opacity:1; transform: none;}
#contents #section2.show h2 {opacity:1; transform: none;}
#contents #section3.show h2 {opacity:1; transform: none;}
#contents #section4.show h2 {opacity:1; transform: none;}
#contents #section5.show h2 {opacity:1; transform: none;}
#contents #section6.show h2 {opacity:1; transform: none;}
            
          
!
            
              var nav = $("#dot ul li");
var contents = $("#contents > div");

nav.click(function(e){
	e.preventDefault();
	var target = $(this);
	var index = target.index();
	// alert(index);
	var section = contents.eq(index);
	var offset = section.offset().top;
	// alert(offset);
	$(".offset_top").text(offset);
	
	$("html,body").animate({scrollTop:offset},600, "easeInOutExpo");
});

$(".offset_top").text($("#section2").offset().top);
$(window).scroll(function(){
	var wScroll = $(this).scrollTop();
	
	$(".scroll_top").text(wScroll);
	if(wScroll >= contents.eq(0).offset().top){
		nav.removeClass("active");
		nav.eq(0).addClass("active");
	}
	if(wScroll >= contents.eq(1).offset().top){
		nav.removeClass("active");
		nav.eq(1).addClass("active");
	}
	if(wScroll >= contents.eq(2).offset().top){
		nav.removeClass("active");
		nav.eq(2).addClass("active");
	}
	if(wScroll >= contents.eq(3).offset().top){
		nav.removeClass("active");
		nav.eq(3).addClass("active");
	}
	if(wScroll >= contents.eq(4).offset().top){
		nav.removeClass("active");
		nav.eq(4).addClass("active");
	}
	if(wScroll >= contents.eq(5).offset().top){
		nav.removeClass("active");
		nav.eq(5).addClass("active");
	}
	
	if(wScroll >= contents.eq(0).offset().top - $(window).height()/3){
		contents.eq(0).addClass("show");
	}
	if(wScroll >= contents.eq(1).offset().top - $(window).height()/3){
		contents.eq(1).addClass("show");
	}
	if(wScroll >= contents.eq(2).offset().top - $(window).height()/3){
		contents.eq(2).addClass("show");
	}
	if(wScroll >= contents.eq(3).offset().top - $(window).height()/3){
		contents.eq(3).addClass("show");
	}
	if(wScroll >= contents.eq(4).offset().top - $(window).height()/3){
		contents.eq(4).addClass("show");
	}
	if(wScroll >= contents.eq(5).offset().top - $(window).height()/3){
		contents.eq(5).addClass("show");
	}
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console