Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                h1 Collapse/Accordion 套件


h2 Default Set, click the title and the content slideUp/slideDown
dl.modules-collapse title1
  dd content1
  dt title2
  dd content2
  dt title3
  dd content3


h2 Add 「class="-keep"」, keep before content slideDown
dl.modules-collapse.-keep title4
  dd content4
  dt title5
  dd content5
  dt title6
  dd content6



                @import compass/reset
@import compass

// body、h1、h2、content color set
$font-color: rgba(#263238, .87) !default

// collpase/accordion color set
$collapse-border: 1px solid #607D8B !default
$collapse-title-bg: #CFD8DC !default
$collapse-title-bg-active: #607D8B !default
$collapse-title-color-active: rgba(white, .87) !default
$collapse-content-bg: #FFF !default

// transition default
  +transition(.5s cubic-bezier(.3, .1, .05, 1))

// default padding: 16px
  padding: 16px

// base set
*, *::before, *::after

  @extend %padding
  background-color: #ECEFF1
  font-family: \5FAE\8EDF\6B63\9ED1\9AD4, Microsoft JhengHei, MingLiU, sans-serif

  text-align: center
  color: $font-color

  padding-bottom: 4px
  color: $font-color

  margin: 11px 2rem 12px
  border: 0
  border-top: 1px solid lighten(#555 ,46)

// collapse/accordion set
  background-color: #ECEFF1
  // title set
  > dt
    position: relative
    z-index: 1
    @extend %padding
    overflow: hidden
    background-color: $collapse-title-bg
    border: $collapse-border
    color: $font-color
    cursor: pointer
    @extend %trnasition-default
    // 背景色特效 bg transform
      content: ""
      position: absolute
      // 清掉border帶來的1px,所以是-1px
      top: -1px
      right: -1px
      bottom: -1px
      left: -1px
      z-index: -1
      background-color: $collapse-title-bg-active
      +transform-origin(0, 0)
      @extend %trnasition-default
    // 「+」符號
      font-family: "FontAwesome"
      content: "\f067"
      position: absolute
      right: 16px
  // hover transform
  > dt:hover
      content: "\f1ce"
      +animation(fa-spin 2s infinite linear)
  // .active set
    color: $collapse-title-color-active
    // 背景色特效
    // 「-」符號
      content: "\f068"
  // content set
  > dd
    display: none
    @extend %padding
    background-color: $collapse-content-bg
    border: $collapse-border
    color: $font-color
  // 頭跟尾的圓角 top & bottom border-radius
  > dt:first-child
    &, &:hover, &::before
  > dd:last-child


                $(function() {
  var $title = $('.modules-collapse > dt');
  var $content = $('.modules-collapse >').next('dd');
  $ {
    // 讓每一組collapse都可以分開使用
    var $modulesTitle = $(this).closest('.modules-collapse');
    // 設定共同展開速度
    var slideSpeed = 500;
    // .-keep的設定
    if($modulesTitle.hasClass('-keep')) {
      if($(this).hasClass('active')) {
      else {
    // not .-keep的設定
    else {
      // 若原本已經是展開的,則收闔
      if($(this).hasClass('active')) {
      else {

        // 被點擊到的展開