backstretch-rails 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/backstretch-rails.gemspec +1 -1
- data/lib/backstretch-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.backstretch.js +35 -15
- metadata +11 -6
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Backstretch::Rails
|
2
2
|
|
3
|
-
A rails asset pipeline packaged version of jQuery Backstretch v2.0.
|
3
|
+
A rails asset pipeline packaged version of jQuery Backstretch v2.0.4 this gem will follow the version number of the backstretch distribution.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
//= require 'jquery
|
21
|
+
//= require 'jquery.backstretch'
|
22
22
|
|
23
23
|
|
24
24
|
## Acknowledgements
|
data/backstretch-rails.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
/*! Backstretch - v2.0.
|
1
|
+
/*! Backstretch - v2.0.4 - 2013-06-19
|
2
2
|
* http://srobbin.com/jquery-plugins/backstretch/
|
3
|
-
* Copyright (c)
|
3
|
+
* Copyright (c) 2013 Scott Robbin; Licensed MIT */
|
4
4
|
|
5
5
|
;(function ($, window, undefined) {
|
6
6
|
'use strict';
|
@@ -9,7 +9,7 @@
|
|
9
9
|
* ========================= */
|
10
10
|
|
11
11
|
$.fn.backstretch = function (images, options) {
|
12
|
-
// We need at least one image
|
12
|
+
// We need at least one image or method name
|
13
13
|
if (images === undefined || images.length === 0) {
|
14
14
|
$.error("No images were supplied for Backstretch");
|
15
15
|
}
|
@@ -26,8 +26,18 @@
|
|
26
26
|
var $this = $(this)
|
27
27
|
, obj = $this.data('backstretch');
|
28
28
|
|
29
|
-
//
|
29
|
+
// Do we already have an instance attached to this element?
|
30
30
|
if (obj) {
|
31
|
+
|
32
|
+
// Is this a method they're trying to execute?
|
33
|
+
if (typeof images == 'string' && typeof obj[images] == 'function') {
|
34
|
+
// Call the method
|
35
|
+
obj[images](options);
|
36
|
+
|
37
|
+
// No need to do anything further
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
|
31
41
|
// Merge the old options with the new
|
32
42
|
options = $.extend(obj.options, options);
|
33
43
|
|
@@ -88,6 +98,7 @@
|
|
88
98
|
, border: 'none'
|
89
99
|
, width: 'auto'
|
90
100
|
, height: 'auto'
|
101
|
+
, maxHeight: 'none'
|
91
102
|
, maxWidth: 'none'
|
92
103
|
, zIndex: -999999
|
93
104
|
}
|
@@ -119,9 +130,12 @@
|
|
119
130
|
* Root: Convenience reference to help calculate the correct height.
|
120
131
|
*/
|
121
132
|
this.$container = $(container);
|
122
|
-
this.$wrap = $('<div class="backstretch"></div>').css(styles.wrap).appendTo(this.$container);
|
123
133
|
this.$root = this.isBody ? supportsFixedPosition ? $(window) : $(document) : this.$container;
|
124
134
|
|
135
|
+
// Don't create a new wrap if one already exists (from a previous instance of Backstretch)
|
136
|
+
var $existing = this.$container.children(".backstretch").first();
|
137
|
+
this.$wrap = $existing.length ? $existing : $('<div class="backstretch"></div>').css(styles.wrap).appendTo(this.$container);
|
138
|
+
|
125
139
|
// Non-body elements need some style adjustments
|
126
140
|
if (!this.isBody) {
|
127
141
|
// If the container is statically positioned, we need to make it relative,
|
@@ -197,20 +211,23 @@
|
|
197
211
|
}
|
198
212
|
|
199
213
|
// Show the slide at a certain position
|
200
|
-
, show: function (
|
214
|
+
, show: function (newIndex) {
|
215
|
+
|
201
216
|
// Validate index
|
202
|
-
if (Math.abs(
|
217
|
+
if (Math.abs(newIndex) > this.images.length - 1) {
|
203
218
|
return;
|
204
|
-
} else {
|
205
|
-
this.index = index;
|
206
219
|
}
|
207
220
|
|
208
221
|
// Vars
|
209
222
|
var self = this
|
210
223
|
, oldImage = self.$wrap.find('img').addClass('deleteable')
|
211
|
-
,
|
212
|
-
|
213
|
-
|
224
|
+
, evtOptions = { relatedTarget: self.$container[0] };
|
225
|
+
|
226
|
+
// Trigger the "before" event
|
227
|
+
self.$container.trigger($.Event('backstretch.before', evtOptions), [self, newIndex]);
|
228
|
+
|
229
|
+
// Set the new index
|
230
|
+
this.index = newIndex;
|
214
231
|
|
215
232
|
// Pause the slideshow
|
216
233
|
clearInterval(self.interval);
|
@@ -235,8 +252,11 @@
|
|
235
252
|
self.cycle();
|
236
253
|
}
|
237
254
|
|
238
|
-
// Trigger the
|
239
|
-
|
255
|
+
// Trigger the "after" and "show" events
|
256
|
+
// "show" is being deprecated
|
257
|
+
$(['after', 'show']).each(function () {
|
258
|
+
self.$container.trigger($.Event('backstretch.' + this, evtOptions), [self, newIndex]);
|
259
|
+
});
|
240
260
|
});
|
241
261
|
|
242
262
|
// Resize
|
@@ -245,7 +265,7 @@
|
|
245
265
|
.appendTo(self.$wrap);
|
246
266
|
|
247
267
|
// Hack for IE img onload event
|
248
|
-
self.$img.attr('src', self.images[
|
268
|
+
self.$img.attr('src', self.images[newIndex]);
|
249
269
|
return self;
|
250
270
|
}
|
251
271
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backstretch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>'
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>'
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.1'
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -72,17 +72,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- - ! '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
hash: 2447830685423720131
|
75
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
79
|
none: false
|
77
80
|
requirements:
|
78
81
|
- - ! '>='
|
79
82
|
- !ruby/object:Gem::Version
|
80
83
|
version: '0'
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
hash: 2447830685423720131
|
81
87
|
requirements: []
|
82
88
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.25
|
84
90
|
signing_key:
|
85
91
|
specification_version: 3
|
86
92
|
summary: Rails asset pipeline packaging for the Backstretch jQuery plugin
|
87
93
|
test_files: []
|
88
|
-
has_rdoc:
|