Skip to content
This repository was archived by the owner on Mar 20, 2018. It is now read-only.

Commit c0e6d3a

Browse files
committed
Added an example and styles
1 parent a409557 commit c0e6d3a

File tree

4 files changed

+115
-9
lines changed

4 files changed

+115
-9
lines changed

css/example.css

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Author: Matt Hinchliffe <www.maketea.co.uk>
3+
* Modified: 13/04/2012
4+
* Description: Some crummy styles to lay out the example file
5+
*/
6+
7+
body {
8+
line-height:1.5;
9+
font-family:Arial, sans-serif;
10+
color:#111;
11+
background:#eee;
12+
}
13+
14+
h1 {
15+
font-size:2em;
16+
margin:0 0 .5em;
17+
}
18+
19+
p {
20+
margin:0 0 1.5em;
21+
}
22+
23+
button {
24+
font-size:1.5em;
25+
line-height:1;
26+
padding:.25em .5em;
27+
border:none;
28+
color:#fff;
29+
background:#333;
30+
border-radius:7px;
31+
cursor:pointer;
32+
}
33+
button:hover {
34+
background-color:#111;
35+
}
36+
37+
#introduction {
38+
width:25em;
39+
margin:5em auto;
40+
text-align:center;
41+
}
42+
43+
#example {
44+
display:none;
45+
}
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
/**
22
* Author: Matt Hinchliffe <www.maketea.co.uk>
3-
* Modified: 08/03/2012
4-
* Description: Simple modal window
3+
* Modified: 10/04/2012
4+
* Description: Simple jQuery modal window
55
* Example:
66
* <div id="modal-wrapper">
77
* <div id="modal-content" />
88
* <span id="modal-close" />
99
* </div>
1010
* <div id="modal-overlay" />
1111
*/
12-
@modalZindex: 300;
1312

1413
.modal-overlay {
14+
z-index:300;
1515
background:rgba(0, 0, 0, 0.25);
16-
z-index:@modalZindex;
1716
}
1817

1918
.modal-wrapper {
19+
z-index:310;
2020
background:#fff;
21-
z-index:@modalZindex + 10;
22-
.box-shadow(3px, 3px, 0, rgba(0, 0, 0, 0.25));
21+
border-radius:15px;
22+
-webkit-box-shadow:0 0 15px rgba(0, 0, 0, 0.25);
23+
-moz-box-shadow:0 0 15px rgba(0, 0, 0, 0.25);
24+
box-shadow:0 0 15px rgba(0, 0, 0, 0.25);
2325
}
2426
.modal-content {
2527
height:100%;
28+
padding:2.5em 1em 1em;
2629
}
2730
.modal-close {
2831
position:absolute;
29-
top:10px;
30-
right:10px;
32+
top:.5em;
33+
right:1em;
34+
z-index:320;
35+
font-size:.75em;
3136
cursor:pointer;
32-
z-index:@modalZindex + 20;
3337
}

index.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
5+
<meta charset="utf-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1" />
7+
8+
<title>jQuery Modal</title>
9+
10+
11+
<link rel="stylesheet" href="css/example.css" />
12+
<link rel="stylesheet" href="css/modal.css" />
13+
14+
<!--
15+
jQuery Modal by Matt Hinchliffe <http://www.maketea.co.uk>
16+
Find out more at GitHub <http://github.com/i-like-robots/jQuery-Modal>
17+
-->
18+
19+
</head>
20+
<body>
21+
22+
<div id="introduction">
23+
<h1>jQuery Modal</h1>
24+
<p class="intro">
25+
Every front-end developer needs their own <a href="http://github.com/i-like-robots/jQuery-Modal">modal
26+
window</a>. The plugin is highly optimised and customisable.
27+
</p>
28+
<p>
29+
<button class="js-open" rel="example">Open the modal</button>
30+
</p>
31+
</div>
32+
33+
<p id="example">
34+
Rump sausage ham short loin pork. Pig venison boudin bresaola, frankfurter sirloin filet mignon pork shankle
35+
capicola. Leberkas jerky ground round short loin bacon. Capicola strip steak flank meatball pork loin beef
36+
ribs turducken, biltong jowl kielbasa rump shank short ribs. Beef beef ribs filet mignon frankfurter,
37+
prosciutto pork chop chicken ground round short ribs tenderloin sirloin fatback brisket.
38+
</p>
39+
40+
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
41+
<script src="js/modal.js"></script>
42+
<script>
43+
$(function()
44+
{
45+
// Create a modal instance
46+
window.modal = $('body').modal().data('modal');
47+
48+
// Bind click event
49+
$(document).on('click', '.js-open', function()
50+
{
51+
modal.open( document.getElementById( this.getAttribute('rel') ).innerHTML );
52+
});
53+
});
54+
</script>
55+
56+
</body>
57+
</html>

modal.js renamed to js/modal.js

File renamed without changes.

0 commit comments

Comments
 (0)