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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                /**
*	jQuery Plugin for simple vertical scrolling - horizontal movement parallax effect
*	I wrote this plugin for a project we have done.
*
*	License:
*	The MIT License (MIT)
*
*	@version 0.8.3
*
*   Copyright (c) 2013 pixxelfactory
*   
*   Permission is hereby granted, free of charge, to any person obtaining a copy
*   of this software and associated documentation files (the "Software"), to deal
*   in the Software without restriction, including without limitation the rights
*   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*   copies of the Software, and to permit persons to whom the Software is
*   furnished to do so, subject to the following conditions:
*   
*   The above copyright notice and this permission notice shall be included in
*   all copies or substantial portions of the Software.
*   
*   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*   THE SOFTWARE.
**/
(function ($) {
    'use strict';

    $.jInvertScroll = function(sel, options) {
        var defaults = {
            width: 'auto',		    // The horizontal container width
            height: 'auto',		    // How far the user can scroll down (shorter distance = faster scrolling)
            onScroll: function(percent) {  // Callback fired when the user scrolls down, the percentage of how far the user has scrolled down gets passed as parameter (format: 0.xxxx - 1.0000)
                // do whatever you like
            }
        };
        
        var config = $.extend(defaults, options);
        
        if(typeof sel === 'Object' && sel.length > 0) {
            return;
        }
        
        var elements = [],
            longest = 0,
            totalHeight,
            winHeight,
            winWidth;

        function init() {
            // Extract all selected elements from dom and save them into an array
            $.each(sel, function (i, val) {
              $(val).each(function (e) {
                elements.push($(this));

                var w = $(this).width();
                if (longest < w) {
                  longest = w;
                }
              });
            });

            // Use the longest elements width + height if set to auto
            if (config.width == 'auto') {
              config.width = longest;
            }

            if (config.height == 'auto') {
              config.height = longest;
            }

            // Set the body to the selected height
            $('body').css('height', config.height + 'px');
        }

        function calc() {
          totalHeight = $(document).height();
          winHeight = $(window).height();
          winWidth = $(window).width();
        }

        function onscroll(e) {
            var currY = $(this).scrollTop();

            // Make calculations
            calc();

            var diff = totalHeight - winHeight;
            var scrollPercent = 0;

            if (diff != 0) {
              // Current percentual position
              scrollPercent = (currY / diff).toFixed(4);
            }

            // Call the onScroll callback
            if(typeof config.onScroll === 'function') {
              config.onScroll.call(this, scrollPercent);
            }

            // do the position calculation for each element
            $.each(elements, function (i, el) {
              var deltaW = el.width() - winWidth;
              if (deltaW <= 0) {
                deltaW = el.width();
              }
              var pos = Math.floor(deltaW * scrollPercent) * -1;
              el.css('left', pos);
            });
        }

        function setlisteners() {
            // Listen for the actual scroll event
            $(window).on('scroll resize', onscroll);
            $([document, window]).on('ready resize', calc);
        }


        // Init actions
        init();
        setlisteners();


        return {
            reinitialize: function() {
                init();
                setlisteners();
            },
            destroy: function() {
                // Remove previously added inline styles
                $('body').attr('style', '');

                // Remove listeners
                $(window).off('scroll resize', onscroll);
                $([document, window]).off('ready resize', calc);
            }
        };
    };
}(jQuery));
              
            
!
999px

Console