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

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="description">
	<div class="indicator"></div>
	<div class="scrollButton1">go scrollTop 2000px</div>
	<div class="scrollButton2">go scrollTop 1000px with Velocity.js animation</div>
	<div class="scrollButton3">go to targetElements with Velocity.js animation</div>



	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt nemo consequatur perferendis natus nisi nostrum sed quam laudantium distinctio voluptas officiis ea, deserunt illum ipsam ipsa fugiat est ex velit, harum ullam ab eum illo hic rem quia! Temporibus molestiae totam ab explicabo dignissimos blanditiis ipsam, sapiente eos placeat nostrum doloremque pariatur, beatae, voluptates quidem voluptatum in porro. Iste impedit pariatur adipisci! Expedita dolorum eos quis repellendus sequi aspernatur perferendis nemo voluptates blanditiis, laboriosam nam sint incidunt porro asperiores assumenda neque officia, id. Recusandae soluta, dolore, quis itaque facere dolor sequi tenetur dolorum, id possimus nesciunt odit nihil amet tempora nulla suscipit velit magnam nisi ullam? Nulla dolores quas veniam fuga illo distinctio nihil molestiae vel repudiandae voluptatibus qui, quaerat debitis obcaecati iste minus quasi placeat enim molestias? Possimus itaque, esse. Quidem, maiores commodi tempora? Magni saepe praesentium, eaque laborum totam ex distinctio reiciendis. Facere cum voluptatem, distinctio ratione nam nisi voluptas excepturi accusantium suscipit qui deleniti dolores possimus, odio quae architecto fugiat fugit at repellat libero laborum minus asperiores maxime. Deleniti iure, praesentium labore laudantium officiis, perferendis, dignissimos eaque debitis sint minus consectetur. At quo assumenda sunt impedit inventore sint nesciunt molestias! Assumenda voluptatem deserunt alias, ex officiis consequuntur!
	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab autem cum maxime deserunt blanditiis in obcaecati fugit, consectetur earum incidunt recusandae, debitis nihil natus quaerat enim voluptatibus perferendis quam magni. Eius doloribus eaque doloremque ea maxime reprehenderit nisi ducimus recusandae neque, culpa ab accusamus vel necessitatibus rerum, sequi molestiae aliquid dolore earum animi velit porro odit maiores. Possimus nam praesentium quos, reiciendis ab, sequi temporibus tenetur alias libero quo veniam, quaerat obcaecati, neque maxime numquam voluptates eum? Impedit natus explicabo libero alias blanditiis nostrum nam, laborum et ipsam doloremque quos, unde a error maxime incidunt saepe. Ipsum nostrum, aspernatur quisquam.
<p class="scrollTarget">target</p>
</div>

            
          
!
            
              .description
	width: 100px
	margin: auto
	position: relative

.indicator
	position: fixed
	top: 10px
	left: 10px
	font-size: 20px
	color: blue

.scrollButton1
	position: fixed
	top: 30px
	left: 10px
	font-size: 20px
	color: red

.scrollButton2
	position: fixed
	left: 10px
	font-size: 20px
	color: red
	top: 50px
	color: green

.scrollButton3
	position: fixed
	left: 10px
	font-size: 20px
	color: red
	top: 70px
	color: purple

.scrollTarget
	font-size: 30px
	color: brown
            
          
!
            
              //http://weboook.blog22.fc2.com/blog-entry-415.html

$(window).scroll(function(){
	let scrollTop =$(window).scrollTop();
	console.log(scrollTop);
	$(".indicator").html("Your window, scrollTop: " + scrollTop);
});

$(".scrollButton1").on("click",function(){
	$("body,html").scrollTop(2000);
});

$(".scrollButton2").on("click",function(){
	$(".scrollTarget").velocity("stop");
	$("html").velocity("scroll",{offset:1000});
});

$(".scrollButton3").on("click",function(){
	$("html").velocity("stop");
	$(".scrollTarget").velocity("scroll",{duration: 10000});
});
            
          
!
999px
Loading ..................

Console