Skip to content

Commit 319de5a

Browse files
committed
Merge branch 'master' of https://github.com/Ferie/cssCollapse
2 parents f3cb10c + baee850 commit 319de5a

61 files changed

Lines changed: 1487 additions & 3677 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines
7+
# 4 space indentation
8+
# Tab indentation
9+
# New line at the end of the file
10+
[*]
11+
end_of_line = lf
12+
indent_size = 4
13+
indent_style = space
14+
insert_final_newline = true
15+
16+
# Set default charset
17+
[*.{js,py,css,scss,html}]
18+
charset = utf-8
19+
20+
# Matches the exact file `index.html`
21+
[index.html]
22+
insert_final_newline = false
23+
24+
# Matches the style files
25+
[*.{css,scss}]
26+
insert_final_newline = false

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules/
1+
node_modules/
2+
yarn.lock

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- "6.17.1"
4+
5+
script: gulp

README.md

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,95 @@
1-
# cssCollapse a simple jQuery plugin that collapses elements of content using CSS3 transitions
1+
# cssCollapse is a jQuery plugin that collapses elements using CSS3 transitions
2+
3+
[![Netlify Status](https://api.netlify.com/api/v1/badges/68db4347-bc46-4c24-813f-6e33d3888f6a/deploy-status)](https://app.netlify.com/sites/css-collapse/deploys)
4+
[![Build Status](https://travis-ci.org/Ferie/cssCollapse.svg?branch=master)](https://travis-ci.org/Ferie/cssCollapse)
5+
[![github tag](https://img.shields.io/github/tag/Ferie/cssCollapse.svg)](https://github.com/Ferie/cssCollapse/tags)
6+
7+
Are you still using jQuery? Would you like a nice CSS transition managed with jQuery? If the answer is "Yes" this is the right place for you.
28

39
This plugin was developed to slide the content of a hidden box using the CSS3 transitions rules.
410

511

12+
## Examples
13+
14+
See the [cssCollapse jQuery plugin](https://jquery-css-collapse.netlify.com/) in action!
15+
16+
617
## Options and parameters
718

819
It works with the following parameters that can be overwritten if needed.
920

10-
* ```accordion```: this variable set if the collapse has to behave like an accordion or not (the default is 'no', this means that if you want the accordion behavior, you have to call the plugin with the variable inside it set to 'yes')
11-
* ```accordionContainer```: this variable is the class that tells the plugin the container class for the accordion (the default is 'accordionContainer')
12-
* ```prefix```: this is the prefix that you can use for all the classes of this plugin to distinguish the instances or the libraries or other plugins that you are using that in some cases can use the same class names (the default is 'cssCollapse-')
13-
* ```targetClass```: this is the target class where the click perform the action. The target can be a link or a button or a box (the default is 'target')
14-
* ```targetSelected```: this is the class that is put to the open accordion target (the default is 'selected')
15-
* ```hiddenContentClass```: this is the class that contain the hidden content that has to be shown when the target class has been clicked (the default is 'hiddenContent')
16-
* ```collapseClass```: this is the class that is put to show the hidden stuff. NOTE: if you change this class you have to modify also the CSS (the default is 'is-open')
17-
* ```iconClass```: this is the general class that you have to add if you are using icon-fonts to indicate the opening and closing of the box (the default is 'collapseIcons')
18-
* ```iconOpen```: this is the class for the icon-font when the hidden content is shown (the default is 'icon-add')
19-
* ```iconClose```: this is the class for the icon-font when the hidden content is hidden (the default is 'icon-minus-fill')
20-
* ```behavior```: this is the CSS3 transitions name that you want to use (the default is empty to let the css rules works itself)
21-
* ```speed```: this is the transitions speed that you want to use (the default is empty to let the css rules works itself)
22-
* ```delay```: this is the CSS3 transitions delay that you want to use (the default is empty to let the css rules works itself)
23-
* ```accordionCloseLinkClass```: this is the the class for the closing link inside the accordion, if needed (the default is 'closeAccordion')
24-
* ```noScrollClass```: this is the the class that you have to use in your HTML near the target class, if you don't want to scroll the page when the target is clicked (the default class name is 'noScroll')
21+
* `accordion`: this variable set if the collapse has to behave like an accordion or not (the default is 'false', this means that if you want the accordion behavior, you have to call the plugin with the variable inside it set to 'true')
22+
* `accordionContainer`: this variable is the class that tells the plugin the container class for the accordion (the default is 'accordionContainer')
23+
* `prefix`: this is the prefix that you can use for all the classes of this plugin to distinguish the instances or the libraries or other plugins that you are using that in some cases can use the same class names (the default is 'cssCollapse-')
24+
* `targetClass`: this is the target class where the click perform the action. The target can be a link or a button or a box (the default is 'target')
25+
* `targetSelected`: this is the class that is put to the open accordion target (the default is 'selected')
26+
* `hiddenContentClass`: this is the class that contain the hidden content that has to be shown when the target class has been clicked (the default is 'hiddenContent')
27+
* `collapseClass`: this is the class that is put to show the hidden stuff. NOTE: if you change this class you have to modify also the CSS (the default is 'is-open')
28+
* `iconClass`: this is the general class that you have to add if you are using icon-fonts to indicate the opening and closing of the box (the default is 'collapseIcons')
29+
* `iconOpen`: this is the class for the icon-font when the hidden content is shown (the default is 'diff-added')
30+
* `iconClose`: this is the class for the icon-font when the hidden content is hidden (the default is 'diff-removed')
31+
* `behavior`: this is the CSS3 transitions name that you want to use examples are `ease`, `linear`, etc (the default is `false` to let the css rules works itself)
32+
* `duration`: this is the transitions speed that you want to use (the default is `false` to let the css rules works itself)
33+
* `delay`: this is the CSS3 transitions delay that you want to use (the default is `false` to let the css rules works itself)
34+
* `accordionCloseLinkClass`: this is the the class for the closing link inside the accordion, if needed (the default is 'closeAccordion')
35+
* `noScrollClass`: this is the the class that you have to use in your HTML near the target class, if you don't want to scroll the page when the target is clicked (the default class name is 'noScroll')
2536

2637
## Usage
2738

28-
Apply the plugin to a single selector that have to contain the target and the hidden content to make it work independently one to the other in the same page.
39+
Get a copy of the plugin from the `dist` folder and add it to your project.
40+
41+
Apply the plugin to a DOM element that have to contain the target (the element that if it is clicked, collapse another element) and the hidden content (the element that is shown/hidden when the target is clicked) to make it work independently one to the other in the same page.
2942

3043
It can be applied also to the entire document if the same behavior is required for all the components inside the page.
3144

32-
Use the plugin as shown in the examples below and in the ```example.html``` file.
45+
Use the plugin as shown in the examples below and/or in the [`example.js`](https://github.com/Ferie/cssCollapse/blob/master/src/js/examples.js) file.
3346

34-
```
35-
$(document).cssCollapse({
36-
accordion: 'yes',
47+
```javascript
48+
$('.box').cssCollapse({
49+
accordion: true,
3750
targetClass: 'accordion-target',
3851
hiddenContentClass: 'accordion-hiddenContent',
39-
iconClose: 'icon-arrow2-down',
40-
iconOpen: 'icon-arrow2-up'
52+
iconClose: 'chevron-down',
53+
iconOpen: 'chevron-up'
4154
});
4255
```
4356

44-
Remember to structure the CSS as shown below. It is a plugin that is using the CSS3 transitions, so some rules are needed.
57+
In the page you can use the following classes:
58+
- `.hiddenContent` (if you want your content to be hidden when the page loads)
4559

46-
In particular the classes that have to be present in the CSS are ```.hiddenContent``` and ```.hiddenContent.is-open```
60+
and/or
61+
- `.hiddenContent.is-open` (if you want your content to be shown when the page loads).
4762

48-
```
63+
64+
### Styles
65+
66+
Use the CSS provided in the `dist` folder or structure it as shown below.
67+
68+
In the following example the CSS3 transitions will be then overwritten from the ones in the plugin, if specified.
69+
70+
```css
4971
.hiddenContent {
5072
overflow-y: hidden;
5173
padding: 0 20px;
5274
max-height: 0px;
5375
-webkit-transition: ease-in-out 600ms max-height;
5476
-moz-transition: ease-in-out 600ms max-height;
55-
-ms-transition: ease-in-out 600ms max-height;
5677
-o-transition: ease-in-out 600ms max-height;
5778
transition: ease-in-out 600ms max-height;
5879
}
5980

6081
.hiddenContent.is-open {
6182
-webkit-transition: ease-in-out 600ms max-height;
6283
-moz-transition: ease-in-out 600ms max-height;
63-
-ms-transition: ease-in-out 600ms max-height;
6484
-o-transition: ease-in-out 600ms max-height;
6585
transition: ease-in-out 600ms max-height;
6686
}
6787
```
6888

69-
The transition attributes can be omitted in the CSS and put in the plugin call as shown before. Remember that if they are present in both places the JS ones are the one that will be played.
70-
71-
72-
73-
## Examples
74-
75-
See the [cssCollapse jQuery plugin](http://riccardoandreatta.com/web-app/cssCollapse/example.html) in actions!!!
76-
77-
78-
7989
---
8090

81-
#### IMPORTANT NOTES
82-
83-
This plugin, obviously, does not show the transition animations for the hidden boxes on older browsers like Internet Explorer 7/8/9 because they do not support the CSS 3 transitions rules.
84-
The behavior on these browsers will be a simple hide/show of the hidden content.
91+
#### Known issue
8592

93+
This plugin, obviously, does not show the transitions on older browsers like Internet Explorer 9 and below, because they do not support CSS3 transitions.
8694

95+
The behavior on these browsers will be a simple hide/show of the hidden content.

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-minimal

assets/css/examples.min.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
2.2 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Loading
1.98 KB
Binary file not shown.
1.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)