4 * Copyright (c) 2008 Piotr Sarnacki (drogomir.com)
6 * Licensed under the MIT license:
7 * http://www.opensource.org/licenses/mit-license.php
12 $.extend($, {lightBoxFu: {}});
13 $.extend($.lightBoxFu, {
14 initialize: function (o) {
15 if($('#lightboxfu').length == 0) {
16 options = {stylesheetsPath: '/stylesheets/', imagesPath: '/images/'};
17 jQuery.extend(options, o);
18 html = '<div id="lightboxfu" style="display: none"><div id="lOverlay"><div id="lWindow"><div id="lInner"></div></div></div></div>';
19 if ($.browser.msie && $.browser.version == '6.0') {
20 html += '<link rel="stylesheet" type="text/css" href="'+options.stylesheetsPath+'lightbox-fu-ie6.css" />';
21 $('body').css('background', 'url('+options.imagesPath+'blank.gif) fixed');
22 } else if($.browser.msie && $.browser.version == '7.0') {
23 html += '<link rel="stylesheet" type="text/css" href="'+options.stylesheetsPath+'lightbox-fu-ie7.css" />';
25 $('body').append(html);
27 $('#lOverlay').css('background', 'url('+options.imagesPath+'overlay.png) fixed');
30 $.lightBoxFu.appendStyle();
33 open: function(options) {
34 options = options || {};
35 $('#lInner').html(options.html);
36 $('#lightboxfu').show();
37 var width = options.width || '250';
38 $('#lInner').css({'width': width});
40 if(options.closeOnClick != false) {
41 $('#lOverlay').one('click', $.lightBoxFu.close);
45 $('#lightboxfu').hide();
47 appendStyle: function() {
49 $('#lOverlay').css({display: 'table'});
50 $('#lOverlay #lWindow').css({display: 'table-cell'});
52 $('#lOverlay').css({position: 'fixed', top: 0, left: 0, width: "100%", height: "100%"});
53 $('#lOverlay #lWindow').css({'vertical-align': 'middle'});
54 $('#lOverlay #lInner').css({width: '300px', 'background-color': '#fff', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', 'max-height': '350px', margin: '0 auto', padding: '15px', overflow: 'auto'});
59 lightBoxFu: function(options){
60 return this.each(function() {
61 $(this).click(function() {
62 $.lightBoxFu.open(options);