1
- jBox
2
- ====
1
+ # jBox
3
2
4
3
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
5
4
@@ -8,76 +7,80 @@ Demo: https://stephanwagner.me/jBox
8
7
Docs: https://stephanwagner.me/jBox/documentation
9
8
10
9
11
- Tooltips
12
- --------
10
+ ## Tooltips
13
11
14
12
Create a new instance of jBox Tooltip and attach it to elements:
15
13
16
- new jBox('Tooltip', {
17
- attach: '.tooltip'
18
- });
14
+ ``` javascript
15
+ new jBox (' Tooltip' , {
16
+ attach: ' .tooltip'
17
+ });
18
+ ```
19
19
20
- Now elements with class="tooltip" will open tooltips:
20
+ Now elements with ` class="tooltip" ` will open tooltips:
21
21
22
- <span class =" tooltip " title =" My first tooltip " >Hover me!</span >
23
- <span class =" tooltip " title =" My second tooltip " >Hover me!</span >
22
+ ``` html
23
+ <span class =" tooltip" title =" My first tooltip" >Hover me!</span >
24
+ <span class =" tooltip" title =" My second tooltip" >Hover me!</span >
25
+ ```
24
26
25
-
26
- Modal windows
27
- -------------
27
+ ## Modal windows
28
28
29
29
You can set up modal windows the same way as tooltips.
30
30
But most of times you'd want more variety, like a title or HTML content:
31
31
32
- new jBox('Modal', {
33
- width: 300,
34
- height: 200,
35
- attach: '#myModal',
36
- title: 'My Modal Window',
37
- content: '<i >Hello there!</i >'
38
- });
39
-
40
- <div id =" myModal " >Click me to open a modal window!</div >
41
-
32
+ ``` javascript
33
+ new jBox (' Modal' , {
34
+ width: 300 ,
35
+ height: 200 ,
36
+ attach: ' #myModal' ,
37
+ title: ' My Modal Window' ,
38
+ content: ' <i>Hello there!</i>'
39
+ });
40
+ ```
41
+ ``` html
42
+ <div id =" myModal" >Click me to open a modal window!</div >
43
+ ```
42
44
43
45
44
- Confirm windows
45
- ---------------
46
+ ## Confirm windows
46
47
47
48
Confirm windows are modal windows which requires the user to confirm a click action on an element.
48
49
Give an element the attribute data-confirm to attach it:
49
50
50
- new jBox('Confirm', {
51
- confirmButton: 'Do it!',
52
- cancelButton: 'Nope'
53
- });
54
-
55
- <div onclick =" alert (' You did it!' )" data-confirm =" Do you really want to do this? " >Click me!</div >
56
- <a href =" https://stephanwagner.me/jBox " data-confirm =" Do you really want to leave this page? " >Click me!</a >
57
-
51
+ ``` javascript
52
+ new jBox (' Confirm' , {
53
+ confirmButton: ' Do it!' ,
54
+ cancelButton: ' Nope'
55
+ });
56
+ ```
57
+ ``` html
58
+ <div onclick =" alert('You did it!')" data-confirm =" Do you really want to do this?" >Click me!</div >
59
+ <a href =" https://stephanwagner.me/jBox" data-confirm =" Do you really want to leave this page?" >Click me!</a >
60
+ ```
58
61
59
- Notices
60
- -------
62
+ ## Notices
61
63
62
64
A notice will open automatically and destroy itself after some time:
63
65
64
- new jBox('Notice', {
65
- content: 'Hurray! A notice!'
66
- });
66
+ ``` javascript
67
+ new jBox (' Notice' , {
68
+ content: ' Hurray! A notice!'
69
+ });
70
+ ```
67
71
68
-
69
- Images
70
- ------
72
+ ## Images
71
73
72
74
To create image windows you only need following few lines:
73
75
74
- new jBox('Image');
75
-
76
- <a href =" /image-large.jpg " data-jbox-image =" gallery1 " title =" My image " ><img src =" /image.jpg " alt =" " ></a >
77
-
76
+ ``` javascript
77
+ new jBox (' Image' );
78
+ ```
79
+ ``` html
80
+ <a href =" /image-large.jpg" data-jbox-image =" gallery1" title =" My image" ><img src =" /image.jpg" alt =" " ></a >
81
+ ```
78
82
79
- Learn more
80
- ----------
83
+ ## Learn more
81
84
82
85
These few examples are very basic.
83
86
The jBox library is quite powerful and offers a vast variety of options to customize appearance and behavior.
0 commit comments