root/afridex/plugins/fresh-page/js/greybox.js @ 22

Revision 21, 1.4 kB (checked in by admin, 18 years ago)
Line 
1/* Greybox Redux
2 * Required: http://jquery.com/
3 * Written by: John Resig
4 * Based on code by: 4mir Salihefendic (http://amix.dk)
5 * License: LGPL (read more in LGPL.txt)
6 */
7
8var GB_DONE = false;
9var GB_HEIGHT = 400;
10var GB_WIDTH = 400;
11
12function GB_show(caption, url, height, width) {
13  GB_HEIGHT = height || 400;
14  GB_WIDTH = width || 400;
15  if(!GB_DONE) {
16    $(document.body)
17      .append("<div id='GB_overlay'></div><div id='GB_window'><div id='GB_caption'></div>"
18        + "<img src='./../wp-content/plugins/fresh-page/images/close.gif' alt='Close window'/></div>");
19    $("#GB_window img").click(GB_hide);
20    $("#GB_overlay").click(GB_hide);
21    $(window).resize(GB_position);
22    GB_DONE = true;
23  }
24
25  $("#GB_frame").remove();
26  $("#GB_window").append("<iframe id='GB_frame' src='"+url+"'></iframe>");
27
28  $("#GB_caption").html(caption);
29  $("#GB_overlay").show();
30  GB_position();
31
32  if(GB_ANIMATION)
33    $("#GB_window").slideDown("slow");
34  else
35    $("#GB_window").show();
36}
37
38function GB_hide() {
39  $("#GB_window,#GB_overlay").hide();
40}
41
42function GB_position() {
43  var de = document.documentElement;
44  var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
45  $("#GB_window").css({width:GB_WIDTH+"px",height:GB_HEIGHT+"px",
46    left: ((w - GB_WIDTH)/2)+"px" });
47  $("#GB_frame").css("height",GB_HEIGHT - 32 +"px");
48}
Note: See TracBrowser for help on using the browser.