lazybox 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -5
- data/lib/lazybox/version.rb +1 -1
- data/vendor/assets/javascripts/lazybox.js +12 -14
- data/vendor/assets/stylesheets/lazybox.css +6 -6
- metadata +4 -4
data/README.md
CHANGED
@@ -70,7 +70,7 @@ In your controller:
|
|
70
70
|
$.lazybox.close()
|
71
71
|
window.location.reload()
|
72
72
|
```
|
73
|
-
![LazyBox](http://i.imgur.com/
|
73
|
+
![LazyBox](http://i.imgur.com/FEYpJ.png)
|
74
74
|
|
75
75
|
###Confirmations
|
76
76
|
|
@@ -82,7 +82,7 @@ And in `application.js`:
|
|
82
82
|
$.rails.allowAction = $.lazybox.confirm;
|
83
83
|
```
|
84
84
|
|
85
|
-
![LazyBox](http://i.imgur.com/
|
85
|
+
![LazyBox](http://i.imgur.com/1OQdU.png)
|
86
86
|
|
87
87
|
for options use global lazybox settings:
|
88
88
|
|
@@ -90,7 +90,7 @@ for options use global lazybox settings:
|
|
90
90
|
$.lazybox.settings = {cancelClass: "button gray", submitClass: 'button gray', overlay: false}
|
91
91
|
```
|
92
92
|
|
93
|
-
![LazyBox](http://i.imgur.com/
|
93
|
+
![LazyBox](http://i.imgur.com/2gW9R.png)
|
94
94
|
|
95
95
|
###Images
|
96
96
|
|
@@ -107,7 +107,16 @@ $(document).ready(function() {
|
|
107
107
|
});
|
108
108
|
```
|
109
109
|
|
110
|
-
![LazyBox](http://i.imgur.com/
|
110
|
+
![LazyBox](http://i.imgur.com/r6pfy.png)
|
111
|
+
|
112
|
+
If there are more than one link to image you can click on image in the lazybox to show the next one
|
113
|
+
|
114
|
+
```haml
|
115
|
+
= link_to image.url, :rel => :lazybox do
|
116
|
+
= image_tag image.url, :height => 100
|
117
|
+
= link_to image2.url, :rel => :lazybox do
|
118
|
+
= image_tag image2.url, :height => 100
|
119
|
+
```
|
111
120
|
|
112
121
|
Options
|
113
122
|
-------
|
@@ -137,7 +146,7 @@ Events
|
|
137
146
|
Browser Compatibility
|
138
147
|
---------------------
|
139
148
|
|
140
|
-
ie7 +
|
149
|
+
ie7 +
|
141
150
|
Chrome
|
142
151
|
Firefox
|
143
152
|
Opera
|
data/lib/lazybox/version.rb
CHANGED
@@ -22,27 +22,27 @@
|
|
22
22
|
var message = element.data('confirm')
|
23
23
|
if (!message) { return true }
|
24
24
|
$.lazybox.show('<p>'+message+'</p><div class="lazy_buttons"><div>', {klass: 'confirm'})
|
25
|
-
element.clone().attr(
|
25
|
+
element.clone().attr('class', options.submitClass).removeAttr('data-confirm').text(options.submitText).appendTo('.lazy_buttons')
|
26
26
|
$('.lazy_buttons').append(' ')
|
27
|
-
$('<a>', {href: '', text: options.cancelText, class: options.cancelClass}).appendTo('.lazy_buttons')
|
27
|
+
$('<a>', {href: '', text: options.cancelText, 'class': options.cancelClass}).appendTo('.lazy_buttons')
|
28
28
|
}
|
29
29
|
});
|
30
30
|
$.fn.lazybox = function(options){
|
31
31
|
var imagesRegexp = new RegExp('\\.(png|jpg|jpeg|gif)(\\?.*)?$', 'i')
|
32
32
|
this.live('click', function(e){
|
33
|
-
var
|
33
|
+
var a = $(this), href = a.attr('href')
|
34
34
|
e.preventDefault()
|
35
35
|
if (href.match(imagesRegexp)){
|
36
36
|
var img = new Image()
|
37
|
-
img.onload = function(){
|
37
|
+
img.onload = function(element){
|
38
|
+
$.lazybox.show('<img title="Click to see next image" src="' + img.src + '" />', options)
|
39
|
+
$('#lazybox img').bind('click', function(){
|
40
|
+
(a.is(':last-child')) ? nextLink = a.siblings('a[rel*=lazybox]:first') : nextLink = a.next('a[rel*=lazybox]:first')
|
41
|
+
$('#lazybox').fadeOut(function(){ nextLink.click() })
|
42
|
+
})
|
43
|
+
}
|
38
44
|
img.src = href
|
39
|
-
} else{
|
40
|
-
$.ajax({
|
41
|
-
url: href,
|
42
|
-
success: function(data){ $.lazybox.show(data, options) },
|
43
|
-
error: function(){ $.lazybox.close() }
|
44
|
-
})
|
45
|
-
}
|
45
|
+
} else $.ajax({url: href, success: function(data){ $.lazybox.show(data, options) }, error: function(){ $.lazybox.close() }})
|
46
46
|
});
|
47
47
|
}
|
48
48
|
|
@@ -57,13 +57,11 @@
|
|
57
57
|
if (options.klass) { $('#lazybox').removeClass().addClass(options.klass) } else { $('#lazybox').removeClass() }
|
58
58
|
if (options.close) {
|
59
59
|
$('#lazybox:not(:has(#lazybox_close))').prepend($("<a id='lazybox_close' title='close'>×</a>"))
|
60
|
-
$('#lazybox_close').live('click', function(){ $.lazybox.close() })
|
61
60
|
if ($.browser.msie) $('#lazybox_close').addClass('ie')
|
62
61
|
} else $('#lazybox_close').remove()
|
63
|
-
if (!options.modal) { $('#lazybox_overlay').bind('click', function(){ $.lazybox.close() }) } else { $('#lazybox_overlay').unbind() }
|
64
62
|
if (!options.modal && options.overlay) { $('#lazybox_overlay').bind('click', function(){ $.lazybox.close() }) } else { $('#lazybox_overlay').unbind() }
|
65
63
|
$(document).keyup(function(e) { if (e.keyCode == 27 && options.esc) $.lazybox.close() })
|
66
|
-
$('#lazybox_body .lazy_buttons a').live('click', function(e){ $.lazybox.close(); e.preventDefault() })
|
64
|
+
$('#lazybox_close, #lazybox_body .lazy_buttons a').live('click', function(e){ $.lazybox.close(); e.preventDefault() })
|
67
65
|
}
|
68
66
|
|
69
67
|
$(document).bind('close.lazybox', function(){ $.lazybox.close() })
|
@@ -14,7 +14,6 @@
|
|
14
14
|
border: 1px solid #ccc;
|
15
15
|
border-radius: 5px;
|
16
16
|
box-shadow: 0 1px 5px #333;
|
17
|
-
color: #7F7F7F;
|
18
17
|
display: none;
|
19
18
|
left: 49%;
|
20
19
|
padding: 20px;
|
@@ -32,13 +31,14 @@ a#lazybox_close {
|
|
32
31
|
box-shadow: 0 1px 5px #333;
|
33
32
|
color: white;
|
34
33
|
cursor: pointer;
|
35
|
-
float: right;
|
36
34
|
font: bold 26px/100% Arial, Helvetica, sans-serif !important;
|
37
35
|
height: 25px;
|
38
|
-
|
39
|
-
|
36
|
+
position: absolute;
|
37
|
+
right: -17px;
|
40
38
|
text-align: center;
|
39
|
+
top: -17px;
|
41
40
|
width: 25px;
|
41
|
+
-moz-border-radius: 20px;
|
42
42
|
-moz-box-shadow: 0 1px 5px #333;
|
43
43
|
-webkit-box-shadow: 0 1px 5px #333;
|
44
44
|
}
|
@@ -49,8 +49,8 @@ a#lazybox_close.ie {
|
|
49
49
|
background: transparent;
|
50
50
|
border: none;
|
51
51
|
color: gray;
|
52
|
-
|
53
|
-
|
52
|
+
right: 0;
|
53
|
+
top: 0;
|
54
54
|
}
|
55
55
|
|
56
56
|
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: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
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-26 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|