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="parent" data-scrollax-parent="true">
	<div id="content" class="content">
		<div data-scrollax="properties: { 'translateY': '-40%' }">
			<header class="major center">
				<h1><a href="https://iprodev.github.io/Scrollax.js/" target="_parent">Scrollax</a></h1>
				<h2>Parallax Particles</h2>
			</header>

			<div class="pos center">
				500 Particles
			</div>

			<pre><code data-language="javascript">// Calling new Scrollax class
var parallax = new Scrollax();
// Initialize Scrollax instance
parallax.init();</code></pre>
			<p class="center">
				With this, you can utilize a lot of Scrollax's awesomeness. You have a smooth &amp; optimized 60 FPS parallax scrolling, and all the other Scrollax's features out of the box.
			</p>
		</div>
	</div>

	<ul id="particles" class="particles"></ul>
</div>
<a class='iprodev' href='http://iprodev.com' target='_blank'>iprodev.com</a>
              
            
!

CSS

              
                body {
	height: 3000px;
	background: #f5f5f5;
	color: #666;
}
/* Content */

.content {
	position: fixed;
	width: 940px;
	top: 50%;
	left: 50%;
	-webkit-transform: translate(-50%, -50%);
	transform: translate(-50%, -50%);
	padding: 1px 0 30px 0;
	z-index: 30;
}

.center {
	text-align: center;
}

pre {
	text-align: left;
}

h1 {
	font-size: 4em;
	margin: 0;
}

h1,
h2 {
	color: #666;
}

.parent {
	width: 100%;
	height: 100%;
}
/* Position */

.pos {
	width: 400px;
	margin: 50px auto;
	padding: 15px 25px;
	font-size: 1em;
	background: #fff;
	line-height: 1.6;
}
/* Particles */

.particles {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	list-style: none;
	overflow: hidden;
}

.particles li {
	position: absolute;
	top: 0;
	left: 0;
	width: 10px;
	height: 10px;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	background: #a03232;
	pointer-events: none;
}

a.iprodev {
	line-height: normal;
	font-family: Varela Round, sans-serif;
	font-weight: 600;
	text-decoration: none;
	font-size: 13px;
	color: #A7AAAE;
	position: fixed;
	left: 20px;
	bottom: 20px;
	border: 1px solid #A7AAAE;
	padding: 12px 20px 10px;
	border-radius: 50px;
	transition: all .1s ease-in-out;
	text-transform: uppercase;
}

a.iprodev:hover {
	background: #A7AAAE;
	color: white;
}
              
            
!

JS

              
                jQuery(document).ready(function($) {
  'use strict';

  var $particles = $('#particles');
  var frame = {};
  var content = {
    start: 0
  };
  var count = 500;
  var minParticleSize = 4;
  var maxParticleSize = 120;
  var particleDistributionPow = 9;
  var particles = [];
  var maxY = frame.height;

  function updateDimensions() {
    frame.width = document.documentElement.offsetWidth;
    frame.height = document.documentElement.offsetHeight;
    maxY = frame.height;
  }

  // Generate particles
  function generateParticles() {
    particles.length = 0;
    var elements = [];
    var $el, zoom, size, x, y, zIndex;

    // Particles
    for (var i = 0; i < count; i++) {
      $el = $('<li/>');
      zoom = Math.pow(Math.random(), particleDistributionPow) * 0.99 + 0.01;
      size = Math.max(minParticleSize, maxParticleSize * zoom);

      x = Math.random() * (frame.width - size);
      y = Math.random() * (maxY - size) - zoom;
      zIndex = Math.round(zoom * 100);

      // Adjust dot size
      $el.css({
        width: Math.round(size),
        height: Math.round(size),
        zIndex: zIndex,
        opacity: 1 - zoom,
        left: Math.round(x),
        top: Math.round(y)
      }).attr('data-scrollax', "properties: { 'translateY': '" + (zIndex - zIndex * 50) + "px' }");

      // Add to particles
      elements.push($el[0]);
    }
    $particles.empty().append(elements);
  }

  updateDimensions();
  generateParticles();

  var parallax = new Scrollax().init();

  $(window).resize(function() {
    updateDimensions();
    generateParticles();

    parallax.reload();
  });
	//You may also like Plugin
	alsolike(
		"mJvweb", "Horizontal Parallax using Scrollax.js",
		"yygvPx", "Modern Tabs Design with pure CSS",
		"azpWBr", "THE CONFETTI ANIMATION"
	);
});
              
            
!
999px

Console