Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

@alecperkins
Created October 15, 2012 19:59
Show Gist options
  • Save alecperkins/3894924 to your computer and use it in GitHub Desktop.
Save alecperkins/3894924 to your computer and use it in GitHub Desktop.

Revisions

  1. Alec Perkins revised this gist Oct 15, 2012. 3 changed files with 21 additions and 3 deletions.
    4 changes: 3 additions & 1 deletion notes.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # sampleproto
    # Rollup test

    *Note: this is a sample [Proto](https://github.com/droptype/proto) project. For more information, see this [walkthrough](http://marquee.by/alecperkins/proto).*

    I think the rollup works best at 0.25s. Any slower and it feels sluggish, and faster is too abrupt.
    11 changes: 11 additions & 0 deletions script.coffee
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,14 @@

    $('.sidebar-item .title').on 'click', ->
    $(this).parent().toggleClass('open')

    $('label').each ->
    $label = $(this)
    console.log this
    $label.on 'click', (e) ->
    e.stopImmediatePropagation()
    e.stopPropagation()
    if $label.find('input').is(':checked')
    $label.addClass('active')
    else
    $label.removeClass('active')
    9 changes: 7 additions & 2 deletions style.styl
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ sidebar_item_padding = 10px
    overflow: hidden
    font-family: Helvetica
    font-weight: 700
    transition(height, 0.5s)
    transition(height, 0.25s)
    &.open
    height: 200px
    .title
    @@ -32,6 +32,7 @@ sidebar_item_padding = 10px
    box-sizing: border-box
    cursor: pointer
    border-bottom: 1px solid #ccc
    background-color: #eee

    .info

    @@ -41,7 +42,11 @@ sidebar_item_padding = 10px
    label
    display: block
    padding: sidebar_item_padding
    &:hover
    &:hover, &.active:hover
    background-color: #eee
    &.active
    background-color: #dfd
    &:active
    background-color: #ddd
    input
    float: right
  2. Alec Perkins revised this gist Oct 15, 2012. 4 changed files with 56 additions and 11 deletions.
    10 changes: 7 additions & 3 deletions markup.jade
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,14 @@

    #sidebar

    .sidebar-item
    span.title Item 1
    div.info
    .sidebar-item.open
    .title Item 1
    .info
    label Some controls
    input(type='checkbox')
    label More controls
    input(type='checkbox')
    label Other controls
    input(type='checkbox')


    4 changes: 2 additions & 2 deletions script.coffee
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    console.log "loaded"


    $('.sidebar-item .title').on 'click', ->
    $(this).parent().toggleClass('open')
    6 changes: 1 addition & 5 deletions settings.json
    Original file line number Diff line number Diff line change
    @@ -4,12 +4,8 @@
    "script_libraries": [
    "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.1/underscore-min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/underscore.string/2.3.0/underscore.string.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.3.3/coffee-script.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js",
    "https://raw.github.com/Marak/Faker.js/master/Faker.js"
    "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js"
    ],
    "style_libraries": [
    "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css"
    47 changes: 46 additions & 1 deletion style.styl
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,47 @@
    transition(prop, dur)
    -webkit-transition-property: prop
    -webkit-transition-duration: dur
    -moz-transition-property: prop
    -moz-transition-duration: dur
    -ms-transition-property: prop
    -ms-transition-duration: dur
    -o-transition-property: prop
    -o-transition-duration: dur
    transition-property: prop
    transition-duration: dur


    #sidebar
    border 1px solid #ccc
    border: 1px solid #ccc
    width: 300px

    sidebar_item_height = 50px
    sidebar_item_padding = 10px
    .sidebar-item
    height: sidebar_item_height
    overflow: hidden
    font-family: Helvetica
    font-weight: 700
    transition(height, 0.5s)
    &.open
    height: 200px
    .title
    font-size: 25px
    height: sidebar_item_height + 1
    padding: sidebar_item_padding
    box-sizing: border-box
    cursor: pointer
    border-bottom: 1px solid #ccc

    .info

    label, input
    cursor: pointer

    label
    display: block
    padding: sidebar_item_padding
    &:hover
    background-color: #eee
    input
    float: right
  3. Alec Perkins revised this gist Oct 15, 2012. 2 changed files with 10 additions and 6 deletions.
    9 changes: 8 additions & 1 deletion markup.jade
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    h1 Hello, world!

    #sidebar

    .sidebar-item
    span.title Item 1
    div.info
    label Some controls
    input(type='checkbox')


    7 changes: 2 additions & 5 deletions style.styl
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,2 @@
    h1
    font-weight 300
    font-family Helvetica


    #sidebar
    border 1px solid #ccc
  4. Alec Perkins created this gist Oct 15, 2012.
    3 changes: 3 additions & 0 deletions markup.jade
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    h1 Hello, world!


    3 changes: 3 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # sampleproto


    3 changes: 3 additions & 0 deletions script.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    console.log "loaded"


    17 changes: 17 additions & 0 deletions settings.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    {
    "name": "sampleproto",
    "proto_version": "0.0.4",
    "script_libraries": [
    "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.1/underscore-min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/underscore.string/2.3.0/underscore.string.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.3.3/coffee-script.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js",
    "https://raw.github.com/Marak/Faker.js/master/Faker.js"
    ],
    "style_libraries": [
    "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css"
    ]
    }
    5 changes: 5 additions & 0 deletions style.styl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    h1
    font-weight 300
    font-family Helvetica