lazybox 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +15 -14
- data/lib/lazybox/version.rb +1 -1
- data/vendor/assets/javascripts/lazybox.js +9 -12
- data/vendor/assets/stylesheets/lazybox.css +18 -16
- metadata +4 -4
data/README.md
CHANGED
@@ -94,8 +94,8 @@ for options use global lazybox settings:
|
|
94
94
|
|
95
95
|
###Images
|
96
96
|
|
97
|
-
```
|
98
|
-
link_to 'Image', image.url, :rel => :lazybox
|
97
|
+
```haml
|
98
|
+
- link_to 'Image', image.url, :rel => :lazybox
|
99
99
|
```
|
100
100
|
Include in your `app/assets/javascripts/application.js`:
|
101
101
|
|
@@ -121,17 +121,18 @@ If there are more than one link to image you can click on image in the lazybox t
|
|
121
121
|
Options
|
122
122
|
-------
|
123
123
|
|
124
|
-
overlay:
|
125
|
-
esc:
|
126
|
-
close:
|
127
|
-
|
128
|
-
|
129
|
-
|
124
|
+
overlay: true|false //default true. Show lazybox overlay
|
125
|
+
esc: true|false //default true. Close lazybox on esc press
|
126
|
+
close: true|false //default true. Show close lazybox button
|
127
|
+
niceClose: true|false //default true. Show nice close button like in fancybox(IE always shows simple close button)
|
128
|
+
modal: true|false //default true. Close lazybox on overlay click
|
129
|
+
opacity: 0.6 //default 0.3. Set opacity for lazybox overlay
|
130
|
+
klass: 'class' // Set class for lazybox. <div id='lazybox' class='class'>...</div>
|
130
131
|
//confirmation options
|
131
|
-
cancelText:
|
132
|
-
submitText:
|
133
|
-
cancelClass:
|
134
|
-
submitClass:
|
132
|
+
cancelText: //default 'Cancel'. Cancel button text
|
133
|
+
submitText: //default 'Ok'. Confirm button text
|
134
|
+
cancelClass: //default 'button'. Cancel button class
|
135
|
+
submitClass: //default 'button'. Confirm button class
|
135
136
|
|
136
137
|
Events
|
137
138
|
------
|
@@ -139,8 +140,8 @@ Events
|
|
139
140
|
$.lazybox.show()
|
140
141
|
$.lazybox.close()
|
141
142
|
$.lazybox.center()
|
142
|
-
$(document).trigger('close.lazybox')
|
143
|
-
$(document).trigger('center.lazybox')
|
143
|
+
$(document).trigger('close.lazybox') //Will be deprecated in next version. Use $.lazybox.close()
|
144
|
+
$(document).trigger('center.lazybox') //Will be deprecated in next version. Use $.lazybox.center()
|
144
145
|
|
145
146
|
|
146
147
|
Browser Compatibility
|
data/lib/lazybox/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
(function($){
|
2
|
-
var defaults = {overlay: true, esc: true, close: true, modal: true, opacity: 0.3, cancelText: 'Cancel', cancelClass: 'button', submitText: 'Ok', submitClass: 'button'}
|
2
|
+
var defaults = {overlay: true, esc: true, close: true, niceClose: true, modal: true, opacity: 0.3, cancelText: 'Cancel', cancelClass: 'button', submitText: 'Ok', submitClass: 'button'}
|
3
3
|
$.lazybox = function(html){ $.lazybox.show(html) }
|
4
4
|
$.extend($.lazybox, {
|
5
5
|
settings: $.extend({}, defaults),
|
@@ -35,11 +35,9 @@
|
|
35
35
|
if (href.match(imagesRegexp)){
|
36
36
|
var img = new Image()
|
37
37
|
img.onload = function(element){
|
38
|
-
$.lazybox.show('<img
|
39
|
-
|
40
|
-
|
41
|
-
$('#lazybox').fadeOut(function(){ nextLink.click() })
|
42
|
-
})
|
38
|
+
$.lazybox.show('<img class="lazy_img" src="' + img.src + '" />', options)
|
39
|
+
nextLink = a.siblings('a[rel*=lazybox]:first') || a.next('a[rel*=lazybox]:first')
|
40
|
+
if (!nextLink.length == 0) $('#lazybox img').bind('click', function(){ $('#lazybox').fadeOut(function(){ nextLink.click() }) })
|
43
41
|
}
|
44
42
|
img.src = href
|
45
43
|
} else $.ajax({url: href, success: function(data){ $.lazybox.show(data, options) }, error: function(){ $.lazybox.close() }})
|
@@ -48,22 +46,21 @@
|
|
48
46
|
|
49
47
|
function init(options){
|
50
48
|
var options = $.extend($.extend({}, defaults), $.lazybox.settings, options)
|
51
|
-
$('body:not(:has(#lazybox))').append("<div id='lazybox'><div id='lazybox_body'></div></div>")
|
52
49
|
if (options.overlay) {
|
53
50
|
$('body:not(:has(#lazybox_overlay))').append("<div id='lazybox_overlay'></div>")
|
54
|
-
$('#lazybox_overlay').css({filter: 'alpha(opacity='+options.opacity*100+')', opacity: options.opacity})
|
55
|
-
$('#lazybox_overlay').fadeIn(500)
|
51
|
+
$('#lazybox_overlay').css({filter: 'alpha(opacity='+options.opacity*100+')', opacity: options.opacity}).fadeIn(500)
|
56
52
|
}
|
53
|
+
$('body:not(:has(#lazybox))').append("<div id='lazybox'><div id='lazybox_body'></div></div>")
|
57
54
|
if (options.klass) { $('#lazybox').removeClass().addClass(options.klass) } else { $('#lazybox').removeClass() }
|
58
55
|
if (options.close) {
|
59
56
|
$('#lazybox:not(:has(#lazybox_close))').prepend($("<a id='lazybox_close' title='close'>×</a>"))
|
60
|
-
if (
|
57
|
+
if (!$.browser.msie && options.niceClose) $('#lazybox_close').addClass('nice')
|
61
58
|
} else $('#lazybox_close').remove()
|
62
59
|
if (!options.modal && options.overlay) { $('#lazybox_overlay').bind('click', function(){ $.lazybox.close() }) } else { $('#lazybox_overlay').unbind() }
|
63
60
|
$(document).keyup(function(e) { if (e.keyCode == 27 && options.esc) $.lazybox.close() })
|
64
61
|
$('#lazybox_close, #lazybox_body .lazy_buttons a').live('click', function(e){ $.lazybox.close(); e.preventDefault() })
|
65
62
|
}
|
66
63
|
|
67
|
-
$(document).bind('close.lazybox', function(){ $.lazybox.close() })
|
68
|
-
$(document).bind('center.lazybox', function(){ $.lazybox.center() })
|
64
|
+
$(document).bind('close.lazybox', function(){ $.lazybox.close(); console.warn('will be deprecated') })
|
65
|
+
$(document).bind('center.lazybox', function(){ $.lazybox.center(); console.warn('will be deprecated') })
|
69
66
|
})(jQuery);
|
@@ -25,34 +25,36 @@
|
|
25
25
|
}
|
26
26
|
|
27
27
|
a#lazybox_close {
|
28
|
+
background: transparent;
|
29
|
+
border: none;
|
30
|
+
color: gray;
|
31
|
+
cursor: pointer;
|
32
|
+
font: bold 26px/100% Arial, Helvetica, sans-serif !important;
|
33
|
+
height: 25px;
|
34
|
+
position: absolute;
|
35
|
+
right: 0;
|
36
|
+
text-align: center;
|
37
|
+
top: 0;
|
38
|
+
width: 25px;
|
39
|
+
}
|
40
|
+
|
41
|
+
a#lazybox_close:hover { color: black; }
|
42
|
+
|
43
|
+
a#lazybox_close.nice {
|
28
44
|
background: black;
|
29
45
|
border: 2px solid white;
|
30
46
|
border-radius: 20px;
|
31
47
|
box-shadow: 0 1px 5px #333;
|
32
48
|
color: white;
|
33
|
-
cursor: pointer;
|
34
|
-
font: bold 26px/100% Arial, Helvetica, sans-serif !important;
|
35
|
-
height: 25px;
|
36
|
-
position: absolute;
|
37
49
|
right: -17px;
|
38
|
-
text-align: center;
|
39
50
|
top: -17px;
|
40
|
-
width: 25px;
|
41
51
|
-moz-border-radius: 20px;
|
42
52
|
-moz-box-shadow: 0 1px 5px #333;
|
43
53
|
-webkit-box-shadow: 0 1px 5px #333;
|
44
54
|
}
|
55
|
+
a#lazybox_close.nice:hover { background: white; border-color: black; color: black; }
|
45
56
|
|
46
|
-
|
47
|
-
|
48
|
-
a#lazybox_close.ie {
|
49
|
-
background: transparent;
|
50
|
-
border: none;
|
51
|
-
color: gray;
|
52
|
-
right: 0;
|
53
|
-
top: 0;
|
54
|
-
}
|
57
|
+
img.lazy_img { cursor: pointer; }
|
55
58
|
|
56
|
-
a#lazybox_close.ie:hover { color: black; }
|
57
59
|
#lazybox .lazy_buttons { margin-top: 15px; text-align: right; }
|
58
60
|
#lazybox.confirm { max-width: 300px; }
|
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: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
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: 2012-03-
|
18
|
+
date: 2012-03-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|