An open API service indexing awesome lists of open source software.

https://github.com/trykickoff/kickoff-code-toggle


https://github.com/trykickoff/kickoff-code-toggle

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

          

# kickoff-code-toggle
A very basic way to toggle code examples. Used on the [trykickoff.com](http://trykickoff.com) site

All classnames are configurable in the options when kickoff-code-toggle is initialised.

## Installation

```
npm install --save kickoff-code-toggle
```

## Usage:

### Javascript
```js
var toggleCode = require('kickoff-code-toggle');

toggleCode({
headings: '.sg-demoHeading',
showCodeEl: 'sg-demoHeading-showCodeBtn',
showCodeBtnText: '❮/❯',
codeContainerEl: 'show-code',
activeClass: 'is-active',
});
```

### HTML markup
```html

Demo 1




This is a piece of demo code

This is a piece of demo code



```

### CSS
```css
.sg-demo-code {
display: none;
}

.sg-demo.show-code .sg-demo-code {
display: block;
}
```

## Build the code
Build relies on [Browserify](http://browserify.org)
```sh
npm run build
```

## Test the code
```sh
npm test
```
Then open your browser at http://localhost:8000

---

Made by [Z&er :zap:](https://github.com/mrmartineau/)