lazybox 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -5
- data/lazybox.gemspec +1 -0
- data/lib/lazybox/version.rb +1 -1
- data/vendor/assets/javascripts/lazybox.js +39 -27
- data/vendor/assets/stylesheets/lazybox.css +26 -23
- metadata +18 -4
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# LazyBox
|
2
2
|
|
3
|
-
Lazybox is a jQuery-based, lightbox
|
4
|
-
Use lazybox with rails 3.1
|
3
|
+
Lazybox is a jQuery-based, lightbox that can display entire remote pages and images.
|
4
|
+
Use lazybox with rails 3.1 assets pipeline.
|
5
5
|
|
6
|
-
LazyBox implemented using only
|
7
|
-
This is high perfomance modal dialogs. All unpacked files take only
|
8
|
-
|
6
|
+
LazyBox implemented using only css and jquery without images.
|
7
|
+
This is high perfomance modal dialogs. All unpacked files take only 4 kb.
|
8
|
+
This is simplest solution for popup windows.
|
9
9
|
|
10
10
|
# Installation
|
11
11
|
|
@@ -74,6 +74,10 @@ or you can set before_filter that will disable layout for ajax requests:
|
|
74
74
|
$(document).trigger('close.lazybox')
|
75
75
|
window.location.reload();
|
76
76
|
|
77
|
+
you can use lazybox for displaing images
|
78
|
+
|
79
|
+
- link_to 'Image', image.url, :rel => :lazybox
|
80
|
+
|
77
81
|
# Options
|
78
82
|
|
79
83
|
overlay: true|false //default true. Show lazybox overlay.
|
data/lazybox.gemspec
CHANGED
data/lib/lazybox/version.rb
CHANGED
@@ -2,38 +2,34 @@
|
|
2
2
|
$.fn.lazybox = function(options){
|
3
3
|
var defaults = {overlay: true, esc: true, close: true, modal: true, opacity: 0.3};
|
4
4
|
var options = $.extend(defaults, options);
|
5
|
-
|
5
|
+
var imagesRegexp = new RegExp('\\.(png|jpg|jpeg|gif)(\\?.*)?$', 'i')
|
6
6
|
this.live('click', function(e){
|
7
|
+
var href = $(this).attr('href');
|
7
8
|
e.preventDefault();
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
$.ajax({
|
15
|
-
url: $(this).attr('href'),
|
16
|
-
success: function(data){
|
17
|
-
$('body:not(:has(#lazybox))').append("<div id='lazybox'><div id='lazybox_body'></div></div>");
|
18
|
-
if (options.cssClass) { $('#lazybox').addClass(options.cssClass) } else { $('#lazybox').removeClass(); }
|
19
|
-
if (options.close) {
|
20
|
-
$('#lazybox:not(:has(#lazybox_close))').prepend($("<a id='lazybox_close' title='close'>×</a>"));
|
21
|
-
if ($.browser.msie) $('#lazybox_close').addClass('ie');
|
22
|
-
} else $('#lazybox_close').remove();
|
23
|
-
$('#lazybox_body').html(data);
|
9
|
+
$('body:not(:has(#lazybox))').append("<div id='lazybox'><div id='lazybox_body'></div></div>");
|
10
|
+
apply_settings(options);
|
11
|
+
if (href.match(imagesRegexp)) {
|
12
|
+
var img = new Image()
|
13
|
+
img.onload = function() {
|
14
|
+
$('#lazybox_body').html('<img src="' + img.src + '" /></div>');
|
24
15
|
center_lazybox();
|
25
16
|
$('#lazybox').fadeIn(300);
|
26
|
-
if (!options.modal) { $('#lazybox_overlay').bind('click', function(){ close_lazybox() }) } else { $('#lazybox_overlay').unbind(); }
|
27
|
-
},
|
28
|
-
error: function(){
|
29
|
-
$('#lazybox_overlay').fadeOut(500);
|
30
17
|
}
|
31
|
-
|
18
|
+
img.src = href
|
19
|
+
} else {
|
20
|
+
$.ajax({
|
21
|
+
url: href,
|
22
|
+
success: function(data){
|
23
|
+
$('#lazybox_body').html(data);
|
24
|
+
center_lazybox();
|
25
|
+
$('#lazybox').fadeIn(300);
|
26
|
+
},
|
27
|
+
error: function(){
|
28
|
+
$('#lazybox_overlay').fadeOut(500);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
32
|
});
|
33
|
-
|
34
|
-
if (options.close) $('#lazybox_close').live('click', function(){ close_lazybox() });
|
35
|
-
if (!options.modal && options.overlay) { $('#lazybox_overlay').bind('click', function(){ close_lazybox() }) } else { $('#lazybox_overlay').unbind(); }
|
36
|
-
$(document).keyup(function(e) { if (e.keyCode == 27 && options.esc) close_lazybox() });
|
37
33
|
}
|
38
34
|
|
39
35
|
function close_lazybox(){
|
@@ -46,6 +42,22 @@
|
|
46
42
|
$('#lazybox').css({ top: ((x < 0) ? 20 : x), left:(($(window).width() - $('#lazybox').outerWidth()) / 2) + $(window).scrollLeft() });
|
47
43
|
}
|
48
44
|
|
45
|
+
function apply_settings(options){
|
46
|
+
if (options.overlay) {
|
47
|
+
$('body:not(:has(#lazybox_overlay))').append("<div id='lazybox_overlay'></div>");
|
48
|
+
$('#lazybox_overlay').css({filter: 'alpha(opacity='+options.opacity*100+')', opacity: options.opacity});
|
49
|
+
$('#lazybox_overlay').fadeIn(500);
|
50
|
+
}
|
51
|
+
if (options.cssClass) { $('#lazybox').addClass(options.cssClass) } else { $('#lazybox').removeClass(); }
|
52
|
+
if (options.close) {
|
53
|
+
$('#lazybox:not(:has(#lazybox_close))').prepend($("<a id='lazybox_close' title='close'>×</a>"));
|
54
|
+
$('#lazybox_close').live('click', function(){ close_lazybox() });
|
55
|
+
if ($.browser.msie) $('#lazybox_close').addClass('ie');
|
56
|
+
} else $('#lazybox_close').remove();
|
57
|
+
if (!options.modal) { $('#lazybox_overlay').bind('click', function(){ close_lazybox() }) } else { $('#lazybox_overlay').unbind(); }
|
58
|
+
if (!options.modal && options.overlay) { $('#lazybox_overlay').bind('click', function(){ close_lazybox() }) } else { $('#lazybox_overlay').unbind(); }
|
59
|
+
$(document).keyup(function(e) { if (e.keyCode == 27 && options.esc) close_lazybox() });
|
60
|
+
}
|
61
|
+
|
49
62
|
$(document).bind('close.lazybox', function(){ close_lazybox() });
|
50
63
|
})(jQuery);
|
51
|
-
|
@@ -1,59 +1,62 @@
|
|
1
1
|
#lazybox_overlay{
|
2
2
|
background: black;
|
3
|
-
position: fixed;
|
4
|
-
top: 0px;
|
5
3
|
bottom: 0px;
|
4
|
+
display: none;
|
6
5
|
left: 0px;
|
6
|
+
position: fixed;
|
7
7
|
right: 0px;
|
8
|
+
top: 0px;
|
8
9
|
z-index: 100;
|
9
10
|
}
|
10
11
|
|
11
12
|
#lazybox{
|
12
|
-
position: absolute;
|
13
|
-
top: 10%;
|
14
|
-
left: 30%;
|
15
13
|
background-color: #fff;
|
14
|
+
border: 1px solid #ccc;
|
15
|
+
border-radius: 10px;
|
16
|
+
box-shadow: 0 1px 5px #333;
|
16
17
|
color: #7F7F7F;
|
18
|
+
display: none;
|
19
|
+
left: 49%;
|
17
20
|
padding: 20px;
|
18
|
-
|
21
|
+
position: absolute;
|
22
|
+
top: 49%;
|
23
|
+
z-index: 101;
|
19
24
|
-moz-border-radius: 10px;
|
20
25
|
-webkit-border-radius: 10px;
|
21
26
|
-khtml-border-radius: 10px;
|
22
|
-
min-width: 200px;
|
23
|
-
min-height: 100px;
|
24
|
-
border-radius: 10px;
|
25
27
|
-moz-box-shadow: 0 1px 5px #333;
|
26
28
|
-webkit-box-shadow: 0 1px 5px #333;
|
27
|
-
box-shadow: 0 1px 5px #333;
|
28
|
-
z-index: 101;
|
29
29
|
}
|
30
30
|
|
31
31
|
a#lazybox_close {
|
32
|
+
background: black;
|
33
|
+
border: 2px solid white;
|
34
|
+
border-radius: 20px;
|
35
|
+
box-shadow: 0 1px 5px #333;
|
32
36
|
color: white;
|
33
|
-
|
37
|
+
cursor: pointer;
|
34
38
|
float: right;
|
39
|
+
font: bold 26px/100% Arial, Helvetica, sans-serif !important;
|
40
|
+
height: 25px;
|
35
41
|
margin-top: -35px;
|
36
42
|
margin-right: -35px;
|
37
|
-
cursor: pointer;
|
38
43
|
text-align: center;
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
border-radius: 20px;
|
44
|
+
width: 25px;
|
45
|
+
-moz-border-radius: 20px;
|
46
|
+
-webkit-border-radius: 20px;
|
47
|
+
-khtml-border-radius: 20px;
|
44
48
|
-moz-box-shadow: 0 1px 5px #333;
|
45
49
|
-webkit-box-shadow: 0 1px 5px #333;
|
46
|
-
box-shadow: 0 1px 5px #333;
|
47
50
|
}
|
48
51
|
|
49
|
-
a#lazybox_close:hover {
|
52
|
+
a#lazybox_close:hover { background: white; border-color: black; color: black; }
|
50
53
|
|
51
54
|
a#lazybox_close.ie {
|
52
|
-
border: none;
|
53
|
-
margin-top: -20px;
|
54
|
-
margin-right: -20px;
|
55
55
|
background: white;
|
56
|
+
border: none;
|
56
57
|
color: gray;
|
58
|
+
margin-right: -20px;
|
59
|
+
margin-top: -20px;
|
57
60
|
}
|
58
61
|
|
59
62
|
a#lazybox_close.ie:hover { color: black; }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazybox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Galushka
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -32,6 +32,20 @@ dependencies:
|
|
32
32
|
version: "3.1"
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: jquery-rails
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
35
49
|
description: This is high perfomance modal dialogs for your Rails application.
|
36
50
|
email:
|
37
51
|
- sexmcs@gmail.com
|