zurb-foundation 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +56 -9
- data/app/assets/images/foundation/misc/button-gloss.png +0 -0
- data/app/assets/images/foundation/misc/button-overlay.png +0 -0
- data/app/assets/images/foundation/misc/custom-form-sprites.png +0 -0
- data/app/assets/images/foundation/misc/input-bg.png +0 -0
- data/app/assets/images/foundation/misc/modal-gloss.png +0 -0
- data/app/assets/images/foundation/misc/table-sorter.png +0 -0
- data/app/assets/images/foundation/orbit/bullets.jpg +0 -0
- data/app/assets/images/foundation/orbit/left-arrow.png +0 -0
- data/app/assets/images/foundation/orbit/loading.gif +0 -0
- data/app/assets/images/foundation/orbit/mask-black.png +0 -0
- data/app/assets/images/foundation/orbit/pause-black.png +0 -0
- data/app/assets/images/foundation/orbit/right-arrow.png +0 -0
- data/app/assets/images/foundation/orbit/rotator-black.png +0 -0
- data/app/assets/images/foundation/orbit/timer-black.png +0 -0
- data/app/assets/javascripts/foundation/app.js +3 -23
- data/app/assets/javascripts/foundation/forms.jquery.js +0 -0
- data/app/assets/javascripts/foundation/index.js +6 -6
- data/app/assets/javascripts/foundation/jquery.customforms.js +0 -0
- data/app/assets/javascripts/foundation/jquery.orbit-1.3.0.js +596 -0
- data/app/assets/javascripts/foundation/jquery.placeholder.min.js.erb +2 -0
- data/app/assets/javascripts/foundation/jquery.reveal.js +0 -0
- data/app/assets/stylesheets/foundation/forms.css.scss.erb +0 -0
- data/app/assets/stylesheets/foundation/globals.css.scss.erb +49 -27
- data/app/assets/stylesheets/foundation/index.css +6 -8
- data/app/assets/stylesheets/foundation/mobile.css.scss.erb +21 -21
- data/app/assets/stylesheets/foundation/{orbit-1.2.3.css.scss.erb → orbit.css.scss.erb} +17 -8
- data/app/assets/stylesheets/foundation/ui.css.scss.erb +0 -0
- data/foundation.gemspec +1 -0
- data/lib/foundation/generators/install_generator.rb +3 -3
- data/lib/foundation/version.rb +1 -1
- metadata +20 -14
- data/app/assets/javascripts/foundation/jquery.orbit-1.2.3.js +0 -401
- data/app/assets/stylesheets/foundation/fonts/league/League_Gothic-webfont.eot +0 -0
- data/app/assets/stylesheets/foundation/fonts/league/League_Gothic-webfont.svg +0 -223
- data/app/assets/stylesheets/foundation/fonts/league/League_Gothic-webfont.ttf +0 -0
- data/app/assets/stylesheets/foundation/fonts/league/League_Gothic-webfont.woff +0 -0
- data/app/assets/stylesheets/foundation/fonts/league/SIL Open Font License 1.1.txt +0 -91
- data/app/assets/stylesheets/foundation/fonts/league/font.css.erb +0 -18
data/README.markdown
CHANGED
@@ -1,14 +1,61 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
WELCOME TO FOUNDATION
|
2
|
+
=====================
|
3
|
+
|
4
|
+
Foundation is a rock-solid, responsive framework for rapidly prototyping and iterating into production code. It includes a 12-column, future-friendly grid and tons of great tools and elements that'll get you up and running in no time.
|
5
|
+
|
6
|
+
Homepage: http://foundation.zurb.com
|
7
|
+
Documentation: http://foundation.zurb.com/docs
|
8
|
+
|
9
|
+
Foundation is MIT-licensed and absolutely free to use. Foundation wouldn't be possible without the support of the entire ZURB team, our friends and colleagues who gave feedback, and some luminaries who did some heavy lifting that we took advantage of (thanks guys).
|
10
|
+
|
11
|
+
Installation
|
12
|
+
============
|
13
|
+
|
14
|
+
Inside your Gemfile add the following line:
|
4
15
|
|
5
16
|
`gem "zurb-foundation"`
|
6
17
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
18
|
+
Then run `bundle install` to install the gem.
|
19
|
+
|
20
|
+
What now?
|
21
|
+
---------
|
22
|
+
|
23
|
+
If you want to include Foundation on all of your application pages (and why wouldn't you!) then run the following to append `foundation` to your application sprockets files:
|
24
|
+
|
25
|
+
`rails g foundation:install`
|
26
|
+
|
27
|
+
You can also manually include `foundation` on specific pages using:
|
11
28
|
|
12
|
-
|
29
|
+
```
|
30
|
+
stylesheet_link_tag "foundation"
|
31
|
+
javascript_include_tag "foundation"
|
32
|
+
```
|
33
|
+
|
34
|
+
Or add `require "foundation"` to your sprockets files like so:
|
35
|
+
|
36
|
+
**in application.css**
|
37
|
+
`/*= require "foundation" */`
|
38
|
+
|
39
|
+
**in application.js**
|
40
|
+
`//= require "foundation"`
|
41
|
+
|
42
|
+
Why use this gem?
|
43
|
+
-----------------
|
44
|
+
|
45
|
+
* Easy to setup: Start using Foundation in mere seconds, like a boss
|
46
|
+
* Paths: All images will work regardless of if you deploy to a sub-uri or not
|
47
|
+
* Clean: Don't clutter up your assets directory
|
48
|
+
|
49
|
+
Dependencies
|
13
50
|
============
|
14
|
-
*
|
51
|
+
* rails (~> 3.1)
|
52
|
+
* jquery-rails (~> 1.0)
|
53
|
+
|
54
|
+
MIT Open Source License
|
55
|
+
=======================
|
56
|
+
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
58
|
+
|
59
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
60
|
+
|
61
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -36,28 +36,8 @@ $(document).ready(function() {
|
|
36
36
|
|
37
37
|
|
38
38
|
/* PLACEHOLDER FOR FORMS ------------- */
|
39
|
-
/* Remove if you don't need :) */
|
39
|
+
/* Remove this and jquery.placeholder.min.js if you don't need :) */
|
40
|
+
|
41
|
+
$('input, textarea').placeholder();
|
40
42
|
|
41
|
-
$('[placeholder]').focus(function() {
|
42
|
-
var input = $(this);
|
43
|
-
if (input.val() == input.attr('placeholder')) {
|
44
|
-
input.val('');
|
45
|
-
input.removeClass('placeholder');
|
46
|
-
}
|
47
|
-
}).blur(function() {
|
48
|
-
var input = $(this);
|
49
|
-
if (input.val() == '' || input.val() == input.attr('placeholder')) {
|
50
|
-
input.addClass('placeholder');
|
51
|
-
input.val(input.attr('placeholder'));
|
52
|
-
}
|
53
|
-
}).blur();
|
54
|
-
$('[placeholder]').parents('form').submit(function() {
|
55
|
-
$(this).find('[placeholder]').each(function() {
|
56
|
-
var input = $(this);
|
57
|
-
if (input.val() == input.attr('placeholder')) {
|
58
|
-
input.val('');
|
59
|
-
}
|
60
|
-
});
|
61
|
-
});
|
62
|
-
|
63
43
|
});
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
|
-
//=
|
2
|
-
//=
|
3
|
-
//=
|
4
|
-
//=
|
5
|
-
//=
|
6
|
-
//=
|
1
|
+
//=require ./jquery.reveal.js
|
2
|
+
//=require ./jquery.orbit-1.3.0.js
|
3
|
+
//=require ./forms.jquery.js
|
4
|
+
//=require ./jquery.customforms.js
|
5
|
+
//=require ./jquery.placeholder.min.js
|
6
|
+
//=require ./app.js
|
File without changes
|
@@ -0,0 +1,596 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Orbit Plugin 1.3.0
|
3
|
+
* www.ZURB.com/playground
|
4
|
+
* Copyright 2010, ZURB
|
5
|
+
* Free to use under the MIT license.
|
6
|
+
* http://www.opensource.org/licenses/mit-license.php
|
7
|
+
*/
|
8
|
+
|
9
|
+
|
10
|
+
(function($) {
|
11
|
+
|
12
|
+
var ORBIT = {
|
13
|
+
|
14
|
+
defaults: {
|
15
|
+
animation: 'horizontal-push', // fade, horizontal-slide, vertical-slide, horizontal-push, vertical-push
|
16
|
+
animationSpeed: 600, // how fast animtions are
|
17
|
+
timer: true, // true or false to have the timer
|
18
|
+
advanceSpeed: 4000, // if timer is enabled, time between transitions
|
19
|
+
pauseOnHover: false, // if you hover pauses the slider
|
20
|
+
startClockOnMouseOut: false, // if clock should start on MouseOut
|
21
|
+
startClockOnMouseOutAfter: 1000, // how long after MouseOut should the timer start again
|
22
|
+
directionalNav: true, // manual advancing directional navs
|
23
|
+
captions: true, // do you want captions?
|
24
|
+
captionAnimation: 'fade', // fade, slideOpen, none
|
25
|
+
captionAnimationSpeed: 600, // if so how quickly should they animate in
|
26
|
+
bullets: false, // true or false to activate the bullet navigation
|
27
|
+
bulletThumbs: false, // thumbnails for the bullets
|
28
|
+
bulletThumbLocation: '', // location from this file where thumbs will be
|
29
|
+
afterSlideChange: $.noop, // empty function
|
30
|
+
fluid: true,
|
31
|
+
centerBullets: true // center bullet nav with js, turn this off if you want to position the bullet nav manually
|
32
|
+
},
|
33
|
+
|
34
|
+
activeSlide: 0,
|
35
|
+
numberSlides: 0,
|
36
|
+
orbitWidth: null,
|
37
|
+
orbitHeight: null,
|
38
|
+
locked: null,
|
39
|
+
timerRunning: null,
|
40
|
+
degrees: 0,
|
41
|
+
wrapperHTML: '<div class="orbit-wrapper" />',
|
42
|
+
timerHTML: '<div class="timer"><span class="mask"><span class="rotator"></span></span><span class="pause"></span></div>',
|
43
|
+
captionHTML: '<div class="orbit-caption"></div>',
|
44
|
+
directionalNavHTML: '<div class="slider-nav"><span class="right">Right</span><span class="left">Left</span></div>',
|
45
|
+
bulletHTML: '<ul class="orbit-bullets"></ul>',
|
46
|
+
|
47
|
+
init: function (element, options) {
|
48
|
+
var $imageSlides,
|
49
|
+
imagesLoadedCount = 0,
|
50
|
+
self = this;
|
51
|
+
|
52
|
+
// Bind functions to correct context
|
53
|
+
this.clickTimer = $.proxy(this.clickTimer, this);
|
54
|
+
this.addBullet = $.proxy(this.addBullet, this);
|
55
|
+
this.resetAndUnlock = $.proxy(this.resetAndUnlock, this);
|
56
|
+
this.stopClock = $.proxy(this.stopClock, this);
|
57
|
+
this.startTimerAfterMouseLeave = $.proxy(this.startTimerAfterMouseLeave, this);
|
58
|
+
this.clearClockMouseLeaveTimer = $.proxy(this.clearClockMouseLeaveTimer, this);
|
59
|
+
this.rotateTimer = $.proxy(this.rotateTimer, this);
|
60
|
+
|
61
|
+
this.options = $.extend({}, this.defaults, options);
|
62
|
+
if (this.options.timer === 'false') this.options.timer = false;
|
63
|
+
if (this.options.captions === 'false') this.options.captions = false;
|
64
|
+
if (this.options.directionalNav === 'false') this.options.directionalNav = false;
|
65
|
+
|
66
|
+
this.$element = $(element);
|
67
|
+
this.$wrapper = this.$element.wrap(this.wrapperHTML).parent();
|
68
|
+
this.$slides = this.$element.children('img, a, div');
|
69
|
+
|
70
|
+
this.$element.bind('orbit.next', function () {
|
71
|
+
self.shift('next');
|
72
|
+
});
|
73
|
+
|
74
|
+
this.$element.bind('orbit.prev', function () {
|
75
|
+
self.shift('prev');
|
76
|
+
});
|
77
|
+
|
78
|
+
this.$element.bind('orbit.goto', function (event, index) {
|
79
|
+
self.shift(index);
|
80
|
+
});
|
81
|
+
|
82
|
+
this.$element.bind('orbit.start', function (event, index) {
|
83
|
+
self.startClock();
|
84
|
+
});
|
85
|
+
|
86
|
+
this.$element.bind('orbit.stop', function (event, index) {
|
87
|
+
self.stopClock();
|
88
|
+
});
|
89
|
+
|
90
|
+
$imageSlides = this.$slides.filter('img');
|
91
|
+
|
92
|
+
if ($imageSlides.length === 0) {
|
93
|
+
this.loaded();
|
94
|
+
} else {
|
95
|
+
$imageSlides.bind('imageready', function () {
|
96
|
+
imagesLoadedCount += 1;
|
97
|
+
if (imagesLoadedCount === $imageSlides.length) {
|
98
|
+
self.loaded();
|
99
|
+
}
|
100
|
+
});
|
101
|
+
}
|
102
|
+
},
|
103
|
+
|
104
|
+
loaded: function () {
|
105
|
+
this.$element
|
106
|
+
.addClass('orbit')
|
107
|
+
.css({width: '1px', height: '1px'});
|
108
|
+
|
109
|
+
this.setDimentionsFromLargestSlide();
|
110
|
+
this.updateOptionsIfOnlyOneSlide();
|
111
|
+
this.setupFirstSlide();
|
112
|
+
|
113
|
+
if (this.options.timer) {
|
114
|
+
this.setupTimer();
|
115
|
+
this.startClock();
|
116
|
+
}
|
117
|
+
|
118
|
+
if (this.options.captions) {
|
119
|
+
this.setupCaptions();
|
120
|
+
}
|
121
|
+
|
122
|
+
if (this.options.directionalNav) {
|
123
|
+
this.setupDirectionalNav();
|
124
|
+
}
|
125
|
+
|
126
|
+
if (this.options.bullets) {
|
127
|
+
this.setupBulletNav();
|
128
|
+
this.setActiveBullet();
|
129
|
+
}
|
130
|
+
},
|
131
|
+
|
132
|
+
currentSlide: function () {
|
133
|
+
return this.$slides.eq(this.activeSlide);
|
134
|
+
},
|
135
|
+
|
136
|
+
setDimentionsFromLargestSlide: function () {
|
137
|
+
//Collect all slides and set slider size of largest image
|
138
|
+
var self = this,
|
139
|
+
$fluidPlaceholder;
|
140
|
+
|
141
|
+
self.$element.add(self.$wrapper).width(this.$slides.first().width());
|
142
|
+
self.$element.add(self.$wrapper).height(this.$slides.first().height());
|
143
|
+
self.orbitWidth = this.$slides.first().width();
|
144
|
+
self.orbitHeight = this.$slides.first().height();
|
145
|
+
$fluidPlaceholder = this.$slides.first().clone();
|
146
|
+
|
147
|
+
this.$slides.each(function () {
|
148
|
+
var slide = $(this),
|
149
|
+
slideWidth = slide.width(),
|
150
|
+
slideHeight = slide.height();
|
151
|
+
|
152
|
+
if (slideWidth > self.$element.width()) {
|
153
|
+
self.$element.add(self.$wrapper).width(slideWidth);
|
154
|
+
self.orbitWidth = self.$element.width();
|
155
|
+
}
|
156
|
+
if (slideHeight > self.$element.height()) {
|
157
|
+
self.$element.add(self.$wrapper).height(slideHeight);
|
158
|
+
self.orbitHeight = self.$element.height();
|
159
|
+
$fluidPlaceholder = $(this).clone();
|
160
|
+
}
|
161
|
+
self.numberSlides += 1;
|
162
|
+
});
|
163
|
+
|
164
|
+
if (this.options.fluid) {
|
165
|
+
if (typeof this.options.fluid === "string") {
|
166
|
+
$fluidPlaceholder = $('<img src="http://placehold.it/' + this.options.fluid + '" />')
|
167
|
+
}
|
168
|
+
|
169
|
+
self.$element.prepend($fluidPlaceholder);
|
170
|
+
$fluidPlaceholder.addClass('fluid-placeholder');
|
171
|
+
self.$element.add(self.$wrapper).css({width: 'inherit'});
|
172
|
+
self.$element.add(self.$wrapper).css({height: 'inherit'});
|
173
|
+
|
174
|
+
$(window).bind('resize', function () {
|
175
|
+
self.orbitWidth = self.$element.width();
|
176
|
+
self.orbitHeight = self.$element.height();
|
177
|
+
});
|
178
|
+
}
|
179
|
+
},
|
180
|
+
|
181
|
+
//Animation locking functions
|
182
|
+
lock: function () {
|
183
|
+
this.locked = true;
|
184
|
+
},
|
185
|
+
|
186
|
+
unlock: function () {
|
187
|
+
this.locked = false;
|
188
|
+
},
|
189
|
+
|
190
|
+
updateOptionsIfOnlyOneSlide: function () {
|
191
|
+
if(this.$slides.length === 1) {
|
192
|
+
this.options.directionalNav = false;
|
193
|
+
this.options.timer = false;
|
194
|
+
this.options.bullets = false;
|
195
|
+
}
|
196
|
+
},
|
197
|
+
|
198
|
+
setupFirstSlide: function () {
|
199
|
+
//Set initial front photo z-index and fades it in
|
200
|
+
var self = this;
|
201
|
+
this.$slides.first()
|
202
|
+
.css({"z-index" : 3})
|
203
|
+
.fadeIn(function() {
|
204
|
+
//brings in all other slides IF css declares a display: none
|
205
|
+
self.$slides.css({"display":"block"})
|
206
|
+
});
|
207
|
+
},
|
208
|
+
|
209
|
+
startClock: function () {
|
210
|
+
var self = this;
|
211
|
+
|
212
|
+
if(!this.options.timer) {
|
213
|
+
return false;
|
214
|
+
}
|
215
|
+
|
216
|
+
if (this.$timer.is(':hidden')) {
|
217
|
+
this.clock = setInterval(function () {
|
218
|
+
this.$element.trigger('orbit.next');
|
219
|
+
}, this.options.advanceSpeed);
|
220
|
+
} else {
|
221
|
+
this.timerRunning = true;
|
222
|
+
this.$pause.removeClass('active')
|
223
|
+
this.clock = setInterval(this.rotateTimer, this.options.advanceSpeed / 180);
|
224
|
+
}
|
225
|
+
},
|
226
|
+
|
227
|
+
rotateTimer: function () {
|
228
|
+
var degreeCSS = "rotate(" + this.degrees + "deg)"
|
229
|
+
this.degrees += 2;
|
230
|
+
this.$rotator.css({
|
231
|
+
"-webkit-transform": degreeCSS,
|
232
|
+
"-moz-transform": degreeCSS,
|
233
|
+
"-o-transform": degreeCSS
|
234
|
+
});
|
235
|
+
if(this.degrees > 180) {
|
236
|
+
this.$rotator.addClass('move');
|
237
|
+
this.$mask.addClass('move');
|
238
|
+
}
|
239
|
+
if(this.degrees > 360) {
|
240
|
+
this.$rotator.removeClass('move');
|
241
|
+
this.$mask.removeClass('move');
|
242
|
+
this.degrees = 0;
|
243
|
+
this.$element.trigger('orbit.next');
|
244
|
+
}
|
245
|
+
},
|
246
|
+
|
247
|
+
stopClock: function () {
|
248
|
+
if (!this.options.timer) {
|
249
|
+
return false;
|
250
|
+
} else {
|
251
|
+
this.timerRunning = false;
|
252
|
+
clearInterval(this.clock);
|
253
|
+
this.$pause.addClass('active');
|
254
|
+
}
|
255
|
+
},
|
256
|
+
|
257
|
+
setupTimer: function () {
|
258
|
+
this.$timer = $(this.timerHTML);
|
259
|
+
this.$wrapper.append(this.$timer);
|
260
|
+
|
261
|
+
this.$rotator = this.$timer.find('.rotator');
|
262
|
+
this.$mask = this.$timer.find('.mask');
|
263
|
+
this.$pause = this.$timer.find('.pause');
|
264
|
+
|
265
|
+
this.$timer.click(this.clickTimer);
|
266
|
+
|
267
|
+
if (this.options.startClockOnMouseOut) {
|
268
|
+
this.$wrapper.mouseleave(this.startTimerAfterMouseLeave);
|
269
|
+
this.$wrapper.mouseenter(this.clearClockMouseLeaveTimer);
|
270
|
+
}
|
271
|
+
|
272
|
+
if (this.options.pauseOnHover) {
|
273
|
+
this.$wrapper.mouseenter(this.stopClock);
|
274
|
+
}
|
275
|
+
},
|
276
|
+
|
277
|
+
startTimerAfterMouseLeave: function () {
|
278
|
+
var self = this;
|
279
|
+
|
280
|
+
this.outTimer = setTimeout(function() {
|
281
|
+
if(!self.timerRunning){
|
282
|
+
self.startClock();
|
283
|
+
}
|
284
|
+
}, this.options.startClockOnMouseOutAfter)
|
285
|
+
},
|
286
|
+
|
287
|
+
clearClockMouseLeaveTimer: function () {
|
288
|
+
clearTimeout(this.outTimer);
|
289
|
+
},
|
290
|
+
|
291
|
+
clickTimer: function () {
|
292
|
+
if(!this.timerRunning) {
|
293
|
+
this.startClock();
|
294
|
+
} else {
|
295
|
+
this.stopClock();
|
296
|
+
}
|
297
|
+
},
|
298
|
+
|
299
|
+
setupCaptions: function () {
|
300
|
+
this.$caption = $(this.captionHTML);
|
301
|
+
this.$wrapper.append(this.$caption);
|
302
|
+
this.setCaption();
|
303
|
+
},
|
304
|
+
|
305
|
+
setCaption: function () {
|
306
|
+
var captionLocation = this.currentSlide().attr('data-caption'),
|
307
|
+
captionHTML;
|
308
|
+
|
309
|
+
if (!this.options.captions) {
|
310
|
+
return false;
|
311
|
+
}
|
312
|
+
|
313
|
+
//Set HTML for the caption if it exists
|
314
|
+
if (captionLocation) {
|
315
|
+
captionHTML = $(captionLocation).html(); //get HTML from the matching HTML entity
|
316
|
+
this.$caption
|
317
|
+
.attr('id', captionLocation) // Add ID caption TODO why is the id being set?
|
318
|
+
.html(captionHTML); // Change HTML in Caption
|
319
|
+
//Animations for Caption entrances
|
320
|
+
switch (this.options.captionAnimation) {
|
321
|
+
case 'none':
|
322
|
+
this.$caption.show();
|
323
|
+
break;
|
324
|
+
case 'fade':
|
325
|
+
this.$caption.fadeIn(this.options.captionAnimationSpeed);
|
326
|
+
break;
|
327
|
+
case 'slideOpen':
|
328
|
+
this.$caption.slideDown(this.options.captionAnimationSpeed);
|
329
|
+
break;
|
330
|
+
}
|
331
|
+
} else {
|
332
|
+
//Animations for Caption exits
|
333
|
+
switch (this.options.captionAnimation) {
|
334
|
+
case 'none':
|
335
|
+
this.$caption.hide();
|
336
|
+
break;
|
337
|
+
case 'fade':
|
338
|
+
this.$caption.fadeOut(this.options.captionAnimationSpeed);
|
339
|
+
break;
|
340
|
+
case 'slideOpen':
|
341
|
+
this.$caption.slideUp(this.options.captionAnimationSpeed);
|
342
|
+
break;
|
343
|
+
}
|
344
|
+
}
|
345
|
+
},
|
346
|
+
|
347
|
+
setupDirectionalNav: function () {
|
348
|
+
var self = this;
|
349
|
+
|
350
|
+
this.$wrapper.append(this.directionalNavHTML);
|
351
|
+
|
352
|
+
this.$wrapper.find('.left').click(function () {
|
353
|
+
self.stopClock();
|
354
|
+
self.$element.trigger('orbit.prev');
|
355
|
+
});
|
356
|
+
|
357
|
+
this.$wrapper.find('.right').click(function () {
|
358
|
+
self.stopClock();
|
359
|
+
self.$element.trigger('orbit.next');
|
360
|
+
});
|
361
|
+
},
|
362
|
+
|
363
|
+
setupBulletNav: function () {
|
364
|
+
this.$bullets = $(this.bulletHTML);
|
365
|
+
this.$wrapper.append(this.$bullets);
|
366
|
+
this.$slides.each(this.addBullet);
|
367
|
+
if (this.options.centerBullets) this.$bullets.css('margin-left', -this.$bullets.width() / 2);
|
368
|
+
},
|
369
|
+
|
370
|
+
addBullet: function (index, slide) {
|
371
|
+
var position = index + 1,
|
372
|
+
$li = $('<li>' + (position) + '</li>'),
|
373
|
+
thumbName,
|
374
|
+
self = this;
|
375
|
+
|
376
|
+
if (this.options.bulletThumbs) {
|
377
|
+
thumbName = $(slide).attr('data-thumb');
|
378
|
+
if (thumbName) {
|
379
|
+
$li
|
380
|
+
.addClass('has-thumb')
|
381
|
+
.css({background: "url(" + this.options.bulletThumbLocation + thumbName + ") no-repeat"});;
|
382
|
+
}
|
383
|
+
}
|
384
|
+
this.$bullets.append($li);
|
385
|
+
$li.data('index', index);
|
386
|
+
$li.click(function () {
|
387
|
+
self.stopClock();
|
388
|
+
self.$element.trigger('orbit.goto', [$li.data('index')])
|
389
|
+
});
|
390
|
+
},
|
391
|
+
|
392
|
+
setActiveBullet: function () {
|
393
|
+
if(!this.options.bullets) { return false; } else {
|
394
|
+
this.$bullets.find('li')
|
395
|
+
.removeClass('active')
|
396
|
+
.eq(this.activeSlide)
|
397
|
+
.addClass('active');
|
398
|
+
}
|
399
|
+
},
|
400
|
+
|
401
|
+
resetAndUnlock: function () {
|
402
|
+
this.$slides
|
403
|
+
.eq(this.prevActiveSlide)
|
404
|
+
.css({"z-index" : 1});
|
405
|
+
this.unlock();
|
406
|
+
this.options.afterSlideChange.call(this, this.$slides.eq(this.prevActiveSlide), this.$slides.eq(this.activeSlide));
|
407
|
+
},
|
408
|
+
|
409
|
+
shift: function (direction) {
|
410
|
+
var slideDirection = direction;
|
411
|
+
|
412
|
+
//remember previous activeSlide
|
413
|
+
this.prevActiveSlide = this.activeSlide;
|
414
|
+
|
415
|
+
//exit function if bullet clicked is same as the current image
|
416
|
+
if (this.prevActiveSlide == slideDirection) { return false; }
|
417
|
+
|
418
|
+
if (this.$slides.length == "1") { return false; }
|
419
|
+
if (!this.locked) {
|
420
|
+
this.lock();
|
421
|
+
//deduce the proper activeImage
|
422
|
+
if (direction == "next") {
|
423
|
+
this.activeSlide++;
|
424
|
+
if (this.activeSlide == this.numberSlides) {
|
425
|
+
this.activeSlide = 0;
|
426
|
+
}
|
427
|
+
} else if (direction == "prev") {
|
428
|
+
this.activeSlide--
|
429
|
+
if (this.activeSlide < 0) {
|
430
|
+
this.activeSlide = this.numberSlides - 1;
|
431
|
+
}
|
432
|
+
} else {
|
433
|
+
this.activeSlide = direction;
|
434
|
+
if (this.prevActiveSlide < this.activeSlide) {
|
435
|
+
slideDirection = "next";
|
436
|
+
} else if (this.prevActiveSlide > this.activeSlide) {
|
437
|
+
slideDirection = "prev"
|
438
|
+
}
|
439
|
+
}
|
440
|
+
|
441
|
+
//set to correct bullet
|
442
|
+
this.setActiveBullet();
|
443
|
+
|
444
|
+
//set previous slide z-index to one below what new activeSlide will be
|
445
|
+
this.$slides
|
446
|
+
.eq(this.prevActiveSlide)
|
447
|
+
.css({"z-index" : 2});
|
448
|
+
|
449
|
+
//fade
|
450
|
+
if (this.options.animation == "fade") {
|
451
|
+
this.$slides
|
452
|
+
.eq(this.activeSlide)
|
453
|
+
.css({"opacity" : 0, "z-index" : 3})
|
454
|
+
.animate({"opacity" : 1}, this.options.animationSpeed, this.resetAndUnlock);
|
455
|
+
}
|
456
|
+
|
457
|
+
//horizontal-slide
|
458
|
+
if (this.options.animation == "horizontal-slide") {
|
459
|
+
if (slideDirection == "next") {
|
460
|
+
this.$slides
|
461
|
+
.eq(this.activeSlide)
|
462
|
+
.css({"left": this.orbitWidth, "z-index" : 3})
|
463
|
+
.animate({"left" : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
464
|
+
}
|
465
|
+
if (slideDirection == "prev") {
|
466
|
+
this.$slides
|
467
|
+
.eq(this.activeSlide)
|
468
|
+
.css({"left": -this.orbitWidth, "z-index" : 3})
|
469
|
+
.animate({"left" : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
//vertical-slide
|
474
|
+
if (this.options.animation == "vertical-slide") {
|
475
|
+
if (slideDirection == "prev") {
|
476
|
+
this.$slides
|
477
|
+
.eq(this.activeSlide)
|
478
|
+
.css({"top": this.orbitHeight, "z-index" : 3})
|
479
|
+
.animate({"top" : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
480
|
+
}
|
481
|
+
if (slideDirection == "next") {
|
482
|
+
this.$slides
|
483
|
+
.eq(this.activeSlide)
|
484
|
+
.css({"top": -this.orbitHeight, "z-index" : 3})
|
485
|
+
.animate({"top" : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
486
|
+
}
|
487
|
+
}
|
488
|
+
|
489
|
+
//horizontal-push
|
490
|
+
if (this.options.animation == "horizontal-push") {
|
491
|
+
if (slideDirection == "next") {
|
492
|
+
this.$slides
|
493
|
+
.eq(this.activeSlide)
|
494
|
+
.css({"left": this.orbitWidth, "z-index" : 3})
|
495
|
+
.animate({"left" : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
496
|
+
this.$slides
|
497
|
+
.eq(this.prevActiveSlide)
|
498
|
+
.animate({"left" : -this.orbitWidth}, this.options.animationSpeed);
|
499
|
+
}
|
500
|
+
if (slideDirection == "prev") {
|
501
|
+
this.$slides
|
502
|
+
.eq(this.activeSlide)
|
503
|
+
.css({"left": -this.orbitWidth, "z-index" : 3})
|
504
|
+
.animate({"left" : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
505
|
+
this.$slides
|
506
|
+
.eq(this.prevActiveSlide)
|
507
|
+
.animate({"left" : this.orbitWidth}, this.options.animationSpeed);
|
508
|
+
}
|
509
|
+
}
|
510
|
+
|
511
|
+
//vertical-push
|
512
|
+
if (this.options.animation == "vertical-push") {
|
513
|
+
if (slideDirection == "next") {
|
514
|
+
this.$slides
|
515
|
+
.eq(this.activeSlide)
|
516
|
+
.css({top: -this.orbitHeight, "z-index" : 3})
|
517
|
+
.animate({top : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
518
|
+
this.$slides
|
519
|
+
.eq(this.prevActiveSlide)
|
520
|
+
.animate({top : this.orbitHeight}, this.options.animationSpeed);
|
521
|
+
}
|
522
|
+
if (slideDirection == "prev") {
|
523
|
+
this.$slides
|
524
|
+
.eq(this.activeSlide)
|
525
|
+
.css({top: this.orbitHeight, "z-index" : 3})
|
526
|
+
.animate({top : 0}, this.options.animationSpeed, this.resetAndUnlock);
|
527
|
+
this.$slides
|
528
|
+
.eq(this.prevActiveSlide)
|
529
|
+
.animate({top : -this.orbitHeight}, this.options.animationSpeed);
|
530
|
+
}
|
531
|
+
}
|
532
|
+
|
533
|
+
this.setCaption();
|
534
|
+
}
|
535
|
+
}
|
536
|
+
};
|
537
|
+
|
538
|
+
$.fn.orbit = function (options) {
|
539
|
+
return this.each(function () {
|
540
|
+
var orbit = $.extend({}, ORBIT);
|
541
|
+
orbit.init(this, options);
|
542
|
+
});
|
543
|
+
};
|
544
|
+
|
545
|
+
})(jQuery);
|
546
|
+
|
547
|
+
/*!
|
548
|
+
* jQuery imageready Plugin
|
549
|
+
* http://www.zurb.com/playground/
|
550
|
+
*
|
551
|
+
* Copyright 2011, ZURB
|
552
|
+
* Released under the MIT License
|
553
|
+
*/
|
554
|
+
(function ($) {
|
555
|
+
|
556
|
+
var options = {};
|
557
|
+
|
558
|
+
$.event.special.imageready = {
|
559
|
+
|
560
|
+
setup: function (data, namespaces, eventHandle) {
|
561
|
+
options = data || options;
|
562
|
+
},
|
563
|
+
|
564
|
+
add: function (handleObj) {
|
565
|
+
var $this = $(this),
|
566
|
+
src;
|
567
|
+
|
568
|
+
if ( this.nodeType === 1 && this.tagName.toLowerCase() === 'img' && this.src !== '' ) {
|
569
|
+
if (options.forceLoad) {
|
570
|
+
src = $this.attr('src');
|
571
|
+
$this.attr('src', '');
|
572
|
+
bindToLoad(this, handleObj.handler);
|
573
|
+
$this.attr('src', src);
|
574
|
+
} else if ( this.complete || this.readyState === 4 ) {
|
575
|
+
handleObj.handler.apply(this, arguments);
|
576
|
+
} else {
|
577
|
+
bindToLoad(this, handleObj.handler);
|
578
|
+
}
|
579
|
+
}
|
580
|
+
},
|
581
|
+
|
582
|
+
teardown: function (namespaces) {
|
583
|
+
$(this).unbind('.imageready');
|
584
|
+
}
|
585
|
+
};
|
586
|
+
|
587
|
+
function bindToLoad(element, callback) {
|
588
|
+
var $this = $(element);
|
589
|
+
|
590
|
+
$this.bind('load.imageready', function () {
|
591
|
+
callback.apply(element, arguments);
|
592
|
+
$this.unbind('load.imageready');
|
593
|
+
});
|
594
|
+
}
|
595
|
+
|
596
|
+
}(jQuery));
|