Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                #header
  %nav
    %a{:href => "#panelOne"} Panel One
    %a{:href => "#panelTwo"} Panel Two
    %a{:href => "#panelThree"} Panel Three
    %span#location
.panelize
  %section#panelOne.panel.one
    %article
      .container
        %header
          %h1 Panel One
        .content
          %p It's a fez. I wear a fez now. Fezes are cool. Sorry, checking all the water in this area; there's an escaped fish. No, I'll fix it. I'm good at fixing rot. Call me the Rotmeister. No, I'm the Doctor. Don't call me the Rotmeister.
          %p I'm the Doctor. Well, they call me the Doctor. I don't know why. I call me the Doctor too. I still don't know why. I hate yogurt. It's just stuff with bits in. I hate yogurt. It's just stuff with bits in. All I've got to do is pass as an ordinary human being. Simple. What could possibly go wrong?
  %section#panelTwo.panel.two
    %article
      .container
        %header
          %h1 Panel Two
        .content
          %p I am the Doctor, and you are the Daleks! Annihilate? No. No violence. I won't stand for it. Not now, not ever, do you understand me?! I'm the Doctor, the Oncoming Storm - and you basically meant beat them in a football match, didn't you? Aw, you're all Mr. Grumpy Face today. It's a fez. I wear a fez now. Fezes are cool. The way I see it, every life is a pile of good things and bad things.…hey.…the good things don't always soften the bad things; but vice-versa the bad things don't necessarily spoil the good things and make them unimportant. Annihilate? No. No violence. I won't stand for it. Not now, not ever, do you understand me?! I'm the Doctor, the Oncoming Storm - and you basically meant beat them in a football match, didn't you?
          %p You hit me with a cricket bat. You know when grown-ups tell you 'everything's going to be fine' and you think they're probably lying to make you feel better? You hit me with a cricket bat. Annihilate? No. No violence. I won't stand for it. Not now, not ever, do you understand me?! I'm the Doctor, the Oncoming Storm - and you basically meant beat them in a football match, didn't you?

          %p I hate yogurt. It's just stuff with bits in. You know how I sometimes have really brilliant ideas? You hit me with a cricket bat.
  %section#panelThree.panel.three
    %article
      .container
        %header
          %h1 Panel Three
        .content
          %p I am the last of my species, and I know how that weighs on the heart so don't lie to me! I am the last of my species, and I know how that weighs on the heart so don't lie to me! It's art! A statement on modern society, 'Oh Ain't Modern Society Awful?'! Stop talking, brain thinking. Hush. I'm the Doctor, I'm worse than everyone's aunt. *catches himself* And that is not how I'm introducing myself. No, I'll fix it. I'm good at fixing rot. Call me the Rotmeister. No, I'm the Doctor. Don't call me the Rotmeister.
          %p Annihilate? No. No violence. I won't stand for it. Not now, not ever, do you understand me?! I'm the Doctor, the Oncoming Storm - and you basically meant beat them in a football match, didn't you? Did I mention we have comfy chairs? No, I'll fix it. I'm good at fixing rot. Call me the Rotmeister. No, I'm the Doctor. Don't call me the Rotmeister. You know how I sometimes have really brilliant ideas? *Insistently* Bow ties are cool! Come on Amy, I'm a normal bloke, tell me what normal blokes do!
              
            
!

CSS

              
                @import compass

/////////////////
// Styles Here //
/////////////////

#header
    position: fixed
    z-index: 2000
    background-color: rgba(0,0,0,.4)
    width: 100%
    nav
        max-width: 900px
        margin: 0 auto
    a
        color: white
        display: inline-block
        text-align: center
        padding: 10px 20px
        text-decoration: none
        &:hover, &.active
            background-color: rgba(0,0,0,.7)

#position-block
    position: fixed
    z-index: 1000
    color: white
h1
    font-family: 'Dosis'
    font-style: normal
    font-weight: 600
    color: white
    font-size: 69px
    line-height: 78px
    padding: 20px 0px 10px 20px
    margin: 0

p
    font-family: 'Ubuntu'
    font-style: normal
    font-weight: 400
    color: white
    font-size: 15px
    line-height: 28px
    margin-top: 0px
    text-align: justify

article
    position: relative
    +box-shadow(black 0px 0px 15px)
    header
        padding-top: 30px
    .content
        +column-count(2)
        +column-gap(60px)
        padding: 0 20px 60px 20px
    .container
        max-width: 900px
        margin: 0 auto

.panel
    position: relative
    width: 100%

.panel.one
    article
        background-color: #00AEFF

.panel.two
    article
        background-color: #292929

.panel.three
    article
        background-color: #FF3500
              
            
!

JS

              
                (($, window, document, undefined_) ->
    Panelize = {
        init: (elements, options) ->
            self = @
            # get default elements for rest of plugin
            self.options = $.extend({}, $.fn.panelize.options, options)
            self.outerContainer = elements
            self.panels = elements.children()
            if self.options.containerSelector isnt null
                self.innerContainers = elements.find(self.options.containerSelector)
            else
                self.innerContainers = self.panels.children()
                self.options.containerSelector = self.innerContainers.first().prop('tagName')

            # set z-index properties for panel elements
            count = self.options.startZ
            self.panels.each ->
                $(@).css('z-index', count)
                count -= self.options.zStep
                return

            # set default height for panels
            self.resize()

            self.panels.css({
                'padding-bottom': $(window).height()
                'position': 'fixed'
                'left': 0
                'top': 0
            }).addClass('static')


            self.panels.first().css('position', 'relative').removeClass('static').addClass('scroll')
            self.panels.last().css('padding-bottom', 0)

            lastPosition = 0

            $(window).on 'scroll', ->
                position = $(@).scrollTop()
                #$('#location').html('Top: '+ $(@).scrollTop())
                $element = $('.scroll').last().find(self.options.containerSelector)
                if(position > lastPosition)
                    # down
                    if(($element.offset().top + $element.outerHeight()) <= position)
                        staticPanels = $('.static')
                        $('.scroll').last().css 'padding-bottom', 0
                        if(staticPanels.length is 1)
                            $('.static').first().addClass('scroll').removeClass('static').css {
                                'position': 'relative'
                                'padding-bottom': 0
                            }
                        else
                            staticPanels.first().addClass('scroll').removeClass('static').css {
                                'position': 'relative'   
                            }
                else
                    #up
                    if($element.offset().top > position)
                        scroll = $('.scroll')
                        if(scroll.length > 1)
                            scroll.last().addClass('static').removeClass('scroll').css 'padding-bottom', $(window).height()
                            $('.static').first().css 'position', 'fixed'

                lastPosition = position
                return

            $(window).resize ->
                clearTimeout resizeDelay
                resizeDelay = setTimeout(self.resize(), self.options.resizeDelay)
                return

            return self.outerContainer

        slide: (id) ->
            self = @
            curPos = $(window).scrollTop()
            dest = self.locations[id]
            time = (Math.abs(curPos - dest) / self.options.speed) * 1000
            $('html,body').animate {
                scrollTop: dest
            }, time
            return self.outerContainer
        resize: ->
            self = @
            self.setHeights()
            setTimeout (->
                self.setOffsets()
            ), 100
            return self.outerContainer
        setHeights: ->
            self = @

            # Set minimum heights for panels to match browser height
            self.innerContainers.css('min-height', $(window).height())
            self.outerContainer.css('min-height', self.getOuterHeight())
            return self.outerContainer
        setOffsets: ->
            self = @

            # Get top offsets fore each panel. This will be used
            # for scrolling between panels
            self.locations = {}
            startingPos = 0
            self.panels.each ->
                height = $(@).find(self.options.containerSelector).outerHeight()
                startingPos += height
                self.locations['#'+$(@).attr('id')] = startingPos - height
                return
            return self.outerContainer
        getOuterHeight: ->
            self = @
            height = 0
            self.innerContainers.each ->
                height += $(@).outerHeight()
                return
            return height

    }

    $.fn.panelize = () ->
        if not $.fn.panelize.instance?
            $.fn.panelize.instance = Object.create(Panelize)
        if typeof arguments[0] is 'object' or arguments[0] is undefined
            return $.fn.panelize.instance.init(@, arguments[0])
        else if arguments[0] is 'resize'
            return $.fn.panelize.instance.resize()
        else if arguments[0] is 'slide' and arguments[1]?
            return $.fn.panelize.instance.slide(arguments[1])
        else
            $.error('Method '+method+' does not exists on jQuery.panelize');


    $.fn.panelize.options = {
        containerSelector: null
        speed: 1000
        startZ: 1000
        zStep: 50
        resizeDelay: 300
    }
) jQuery, window, document


$(document).ready ->

    $panels = $('.panelize').panelize({
        containerSelector: 'article'
        speed: 2000
        startZ: 1000
        zStep: 50
    })

    $nav = $('#header a')
    $nav.click (e) ->
        e.preventDefault()
        $nav.removeClass('active')
        $(@).addClass('active')
        $panels.panelize('slide', $(@).attr('href'))
              
            
!
999px

Console