Skip to content

Commit 1f59829

Browse files
committed
updating local files
0 parents  commit 1f59829

File tree

12 files changed

+1232
-0
lines changed

12 files changed

+1232
-0
lines changed

LICENSE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
This is **multi-licensed**. You may choose to use it under **one of the following licenses**:
2+
3+
- **BSD 3-Clause License** or
4+
- **Apache License 2.0** or
5+
- **GNU LGPL v3** or
6+
- **[HLNC License](http://bloxtor.com/LICENSE_HLNC.md)**
7+
8+
Select the license that best fits your needs.
9+
10+
**This is 100% open to your needs!**
11+
12+
© 2025 [Bloxtor](http://bloxtor.com) and [Joao Pinto](http://jplpinto.com)

README.md

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
# JQuery My Fancy Light Box
2+
3+
> Original Repos:
4+
> - JQuery My Fancy Light Box: https://github.com/a19836/jquerymyfancylightbox/
5+
> - Bloxtor: https://github.com/a19836/bloxtor/
6+
7+
## Overview
8+
9+
**JQuery My Fancy Light Box** is a lightweight JavaScript library to display popups.
10+
11+
Check out a live example by opening [index.html](index.html).
12+
13+
Requirements:
14+
- jquery library
15+
16+
---
17+
18+
## Screenshots
19+
20+
- [example 1](./img/example_1.png)
21+
- [example 2](./img/example_2.png)
22+
- [example 3](./img/example_3.png)
23+
- [example 4](./img/example_4.png)
24+
25+
---
26+
27+
## Usage
28+
29+
```html
30+
<html>
31+
<head>
32+
<!-- Add jquery lib -->
33+
<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
34+
35+
<!-- Add Fancy LighBox lib -->
36+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" media="screen, projection" />
37+
<script language="javascript" type="text/javascript" src="js/jquery.myfancybox.js"></script>
38+
39+
<style>
40+
a {margin-bottom:10px; display:block;}
41+
.myfancypopup.yellow { background:yellow; }
42+
</style>
43+
<script>
44+
var MyFancyPopup2 = null;
45+
46+
function showPopup1() {
47+
MyFancyPopup.init({
48+
elementToShow: $('#popup1')
49+
});
50+
MyFancyPopup.showPopup({
51+
not_draggable: true
52+
});
53+
}
54+
function showPopup2() {
55+
MyFancyPopup.init({
56+
elementToShow: $('#popup2')
57+
});
58+
MyFancyPopup.showPopup();
59+
}
60+
function showPopup3() {
61+
if (!MyFancyPopup2) {
62+
MyFancyPopup2 = new MyFancyPopupClass();
63+
MyFancyPopup2.init({
64+
elementToShow: $('#popup3'),
65+
parentElement: $('section').first(),
66+
type: "iframe",
67+
url: "iframe.html",
68+
refreshIframeOnOpen: true,
69+
popupClass: "yellow",
70+
onIframeOnLoad: function() {
71+
MyFancyPopup.hideLoading();
72+
}
73+
});
74+
}
75+
76+
MyFancyPopup2.showPopup();
77+
}
78+
</script>
79+
</head>
80+
<body>
81+
<div id="popup1" class="myfancypopup">
82+
<div class="title">NOT Draggable Popup</div>
83+
<p class="content">CONTENT HERE</p>
84+
</div>
85+
86+
<div id="popup2" class="myfancypopup">
87+
<h1>Draggable Popup with inline iframe</h1>
88+
<iframe src="iframe.html"></iframe>
89+
</div>
90+
91+
<section class="some_node">
92+
<div id="popup3" class="myfancypopup">
93+
<h1>Popup with auto iframe</h1>
94+
</div>
95+
</section>
96+
97+
<a href="#" onClick="showPopup1();">CLICK HERE TO SEE POPUP 1</a>
98+
<a href="#" onClick="showPopup2();">CLICK HERE TO SEE POPUP 2</a>
99+
<a href="#" onClick="showPopup3();">CLICK HERE TO SEE POPUP 3</a>
100+
</body>
101+
</html>
102+
```
103+
104+
## Other calls
105+
106+
Create new MyFancyPopup object:
107+
```
108+
var MyFancyPopup2 = new MyFancyPopupClass();
109+
```
110+
111+
Initialize MyFancyPopup based in a html element:
112+
```
113+
MyFancyPopup.init({
114+
elementToShow: $('#some_selector'), //html node that should be converted in a popup
115+
parentElement: document, //node where the overlay and loading will be appended
116+
onOpen: function() { ... }, //callback on popup open
117+
onClose: function() { ... }, //callback on popup close
118+
beforeClose: function() { ... }, //callback on before popup close
119+
popupClass: "some_class", //this call will be used in the elementToShow, loading and overlay nodes.
120+
});
121+
```
122+
123+
Initialize MyFancyPopup based in a html element with a dynamic iframe:
124+
```
125+
MyFancyPopup.init({
126+
elementToShow: $('#some_selector'), //html node that should be converted in a popup
127+
parentElement: $('section').first(), //node where the overlay and loading will be appended
128+
type: "iframe",
129+
url: "iframe.html", //url for the iframe
130+
refreshIframeOnOpen: true, //if true, every time the popup open, it will refresh the iframe url
131+
onIframeUnLoad: function() { ... }, //callback on iframe unload
132+
onIframeBeforeUnLoad: function() { ... }, //callback on before iframe unload
133+
onIframeOnLoad: function() { ... }, //callback on iframe load
134+
onOpen: function() { ... }, //callback on popup open
135+
onClose: function() { ... }, //callback on popup close
136+
beforeClose: function() { ... }, //callback on before popup close
137+
popupClass: "some_class", //this call will be used in the elementToShow, loading and overlay nodes.
138+
});
139+
```
140+
141+
Get initial settings when calling the init method:
142+
```
143+
MyFancyPopup.settings;
144+
```
145+
146+
Show/open popup:
147+
```
148+
var opts = {
149+
not_draggable: true //optional: if true, popup is not draggable.
150+
}
151+
MyFancyPopup.showPopup(opts); //opts are optional
152+
```
153+
154+
Reshow popup by hidding and showing it again:
155+
```
156+
var opts = {
157+
not_draggable: true //optional: if true, popup is not draggable.
158+
}
159+
MyFancyPopup.reshowPopup(opts); //opts are optional
160+
```
161+
162+
163+
Hide popup:
164+
```
165+
MyFancyPopup.hidePopup();
166+
```
167+
168+
Update popup position and overlay:
169+
```
170+
MyFancyPopup.updatePopup();
171+
```
172+
173+
Destroy popup and corresponding handlers:
174+
```
175+
MyFancyPopup.destroyPopup();
176+
```
177+
178+
Checks if popup is opened:
179+
```
180+
var shown = MyFancyPopup.isPopupOpened();
181+
```
182+
183+
Center popup:
184+
```
185+
MyFancyPopup.centerPopupHtmlElm(elm, parent); //elm and parent are optional
186+
```
187+
188+
Get popup element corresponding to elementToShow:
189+
```
190+
var popup = self.getPopup();
191+
```
192+
193+
Reset the Z-index of the pop-up window by moving it to the front:
194+
```
195+
MyFancyPopup.reinitZIndex();
196+
```
197+
198+
Set an option:
199+
```
200+
MyFancyPopup.setOption(option_name, option_value)
201+
```
202+
203+
Get an option:
204+
```
205+
var option = MyFancyPopup.getOption = function(option_name)
206+
```
207+
208+
Get an element offset (top and left positions):
209+
```
210+
var offset = MyFancyPopup.getOffset(elm);
211+
```
212+
213+
Get overlay element:
214+
```
215+
var overlay = MyFancyPopup.getOverlay();
216+
```
217+
218+
Show overlay:
219+
```
220+
MyFancyPopup.showOverlay();
221+
```
222+
223+
hide overlay:
224+
```
225+
MyFancyPopup.hideOverlay();
226+
```
227+
228+
Resize overlay and fits it to the screen or parent element depending of its css:
229+
```
230+
MyFancyPopup.resizeOverlay();
231+
```
232+
233+
Get loading icon node:
234+
```
235+
var loading = MyFancyPopup.getLoading();
236+
```
237+
238+
Show loading icon:
239+
```
240+
MyFancyPopup.showLoading();
241+
```
242+
243+
Hide loading icon:
244+
```
245+
MyFancyPopup.hideLoading();
246+
```
247+
248+
Get popup close button:
249+
```
250+
var btn = MyFancyPopup.getPopupCloseButton();
251+
```
252+
253+
Creates a close button if not exists and set the correspondent handler to close popup:
254+
```
255+
MyFancyPopup.prepareElementCloseButton();
256+
```
257+
258+
Creates iframe node if not exists and set the correspondent handlers and classes:
259+
```
260+
MyFancyPopup.prepareElementIfIframe();
261+
```
262+

css/style.css

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright (c) 2025 Bloxtor (http://bloxtor.com) and Joao Pinto (http://jplpinto.com)
3+
*
4+
* Multi-licensed: BSD 3-Clause | Apache 2.0 | GNU LGPL v3 | HLNC License (http://bloxtor.com/LICENSE_HLNC.md)
5+
* Choose one license that best fits your needs.
6+
*
7+
* Original JQuery My Fancy Light Box Repo: https://github.com/a19836/jquerymyfancylightbox/
8+
* Original Bloxtor Repo: https://github.com/a19836/bloxtor
9+
*
10+
* YOU ARE NOT AUTHORIZED TO MODIFY OR REMOVE ANY PART OF THIS NOTICE!
11+
*/
12+
13+
.popup_overlay {
14+
display:none;
15+
top:0px;
16+
left:0px;
17+
right:0px;
18+
bottom:0px;
19+
position:absolute;/* DO NOT CHANGE THIS POSITION TO FIXED, OTHERWISE THE OVERLAY WILL NOT WORK CORRECTLY WHEN THE WINDOW IS SCROLL DOWN */
20+
background-color:#333;
21+
opacity:0.6;
22+
filter: alpha(opacity=60);/* For IE */
23+
z-index:1000;
24+
}
25+
.popup_loading {
26+
position:fixed;
27+
z-index:1002;
28+
padding:5px;
29+
background-color:#666;
30+
border:1px outset #000;
31+
32+
-moz-border-radius:0.5em;
33+
-webkit-border-radius:0.5em;
34+
border-radius:0.5em;
35+
opacity:0.8;
36+
filter: alpha(opacity=80);/* For IE */
37+
}
38+
.popup_loading .spining {
39+
background:url('../img/loading.gif') no-repeat;
40+
width:24px;
41+
height:24px;
42+
}
43+
.popup_close {
44+
background: url("../img/fancybox_sprite.png") no-repeat;
45+
position: absolute;
46+
top: -10px;
47+
right: -10px;
48+
width: 36px;
49+
height: 36px;
50+
cursor: pointer;
51+
z-index:1003;
52+
}
53+
54+
.myfancypopup {
55+
display:none;
56+
position:absolute;
57+
border:1px outset #999;
58+
-moz-border-radius:0.5em;
59+
-webkit-border-radius:0.5em;
60+
border-radius:0.5em;
61+
background-color:#FFF;
62+
padding:10px 20px 10px 20px;
63+
z-index:1001;
64+
cursor:move;
65+
}
66+
.myfancypopup .title {
67+
text-align:center;
68+
/*font-size:16px;
69+
color:#333;*/
70+
margin-bottom:5px;
71+
min-width:150px;
72+
}
73+
.myfancypopup .content {
74+
color:#666;
75+
}
76+
77+
78+
.myfancypopup iframe {
79+
border:0;
80+
padding:0;
81+
margin:0;
82+
}

iframe.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html>
3+
<head>
4+
<style>
5+
body {
6+
background:#ddd;
7+
}
8+
</style>
9+
</head>
10+
<body>
11+
Some iframe content
12+
</body>
13+
</html>
14+
15+

img/example_1.png

8.96 KB
Loading

img/example_2.png

59.3 KB
Loading

img/example_3.png

111 KB
Loading

img/example_4.png

55.1 KB
Loading

img/fancybox_sprite.png

1.33 KB
Loading

img/loading.gif

3.78 KB
Loading

0 commit comments

Comments
 (0)