https://github.com/trykickoff/kickoff-code-toggle
https://github.com/trykickoff/kickoff-code-toggle
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/trykickoff/kickoff-code-toggle
- Owner: TryKickoff
- Created: 2016-03-15T13:17:39.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-15T13:18:40.000Z (over 10 years ago)
- Last Synced: 2025-08-19T05:42:22.042Z (11 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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/)