Skip to content

Commit aee5d09

Browse files
committed
Update README.md
1 parent df3b7d1 commit aee5d09

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,32 @@ simplebox.js is a lightweight lightbox plugin (1.4 KB) that is easy to modify or
44

55
The idea behind this plugin was to make setting up lightbox painless. My experience with finding and setting up lightbox plugins has been pretty bad. The plugins I've come across almost always have too many features. simplebox.js is designed to have just one feature: lightboxing. It's responsive out of the box and allows only a few crucial settings.
66

7+
## Installation
8+
To install simplebox, you will have to include the following resources in your page. The JS files should be loaded in the order stipulated below. For the CSS file, you can either incorporate it with your site's stylesheet, or load it externally through the `<link>` element in `<head>`.
9+
10+
| Type | File Name | Description |
11+
|------|----------------------|------------------------------------------------------------------------------------------------------------------------|
12+
| JS | [jQuery](http://jquery.com) | jQuery is obviously needed |
13+
| JS | `dist/js/simplebox.min.js` | Confers the main functionality of the plugin. |
14+
| CSS | `dist/css/simplebox.min.css` | Offers styles that are crucial for the correct display of simplebox. The appearance will break if this is not included. Properties in this file include the necessary vendor prefixes. |
15+
| IMG | `dist/img/cross.svg` | Acts as the default cross/close icon for the lightbox. Add this to your images folder. |
16+
717
## Usage
18+
### Basic
19+
It is rather straightforward to use simplebox&mdash;just add the **slb** class to all the images you want this plugin to work for and then simply chain the `.simplebox()` method to `$(".slb")` in your JavaScript.
820

9-
1. To get started, clone or download the zip for the repository. Once downloaded, you can checkout the demo inside the demo folder if you want.
10-
2. To hook the plugin up with your website, copy everything in the /dist folder and add it your project.
11-
- **CSS:** You can either include the simplebox.min.css as a an individual file to your project or include it into your main stylesheet (as an SCSS partial?) to cut down on HTTP requests.
12-
- **Images**: There is only one image included which is the default 'X' icon for the lightbox. You do have the option to override this image using the plugin's settings (more on this later). Add this image to your primary images folder.
13-
- **JS**: This is the heart and soul of the plugin. Add the js file to your project.
14-
3. After adding the files and making sure you have jQuery hooked up, just call the plugin:
21+
```html
22+
<img class="slb" src="/path/to/image" alt="lorem ipsum" />
23+
```
1524

16-
```JavaScript
17-
// This works if you include the cross.svg image in a /img folder
18-
$('.slb').simplebox();
25+
```javascript
26+
$(function () {
27+
// This assumes that you have placed the cross.svg file inside /img in your project
28+
$(".slb").simplebox();
29+
});
1930
```
2031

21-
## Options
32+
### Advanced
2233

2334
The plugin comes with three options. Yes, just three. Think of this as a feature and not a drawback! If you want to access these options, call the plugin like this:
2435

0 commit comments

Comments
 (0)