groundworkcss-rails 0.2.3 → 0.2.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.
Files changed (21) hide show
  1. data/lib/groundworkcss/rails/version.rb +1 -1
  2. data/lib/groundworkcss/rails/version.rb~ +1 -1
  3. data/vendor/assets/javascripts/groundworkcss/groundwork.all.js +96 -20
  4. data/vendor/assets/javascripts/groundworkcss/groundwork.js +51 -12
  5. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js +67 -0
  6. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.carousel.js +265 -0
  7. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.center.js +63 -0
  8. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.ie-fade.js +46 -0
  9. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.scrollVert.js +15 -0
  10. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.shuffle.js +62 -0
  11. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.swipe.js +70 -0
  12. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.tile.js +131 -0
  13. data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.video.js +66 -0
  14. data/vendor/assets/javascripts/groundworkcss/plugins/jquery.cycle2.js +1426 -0
  15. data/vendor/assets/stylesheets/groundworkcss-scss/_buttons.scss +4 -3
  16. data/vendor/assets/stylesheets/groundworkcss-scss/_cycle.scss +20 -0
  17. data/vendor/assets/stylesheets/groundworkcss-scss/_modals.scss +2 -1
  18. data/vendor/assets/stylesheets/groundworkcss-scss/_navigation.scss +9 -3
  19. data/vendor/assets/stylesheets/groundworkcss-scss/_tabs.scss +5 -0
  20. data/vendor/assets/stylesheets/groundworkcss-scss/groundwork.scss +2 -2
  21. metadata +25 -14
@@ -1,5 +1,5 @@
1
1
  module Groundworkcss
2
2
  module Rails
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Groundworkcss
2
2
  module Rails
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -1,5 +1,11 @@
1
1
  // Generated by CoffeeScript 1.6.1
2
2
 
3
+ /* --------------------------------------------
4
+ Begin groundwork.coffee
5
+ --------------------------------------------
6
+ */
7
+
8
+
3
9
  /*
4
10
  *
5
11
  * GroundworkCSS JS by Gary Hepting - https://github.com/groundworkcss/groundwork
@@ -12,12 +18,21 @@
12
18
 
13
19
 
14
20
  (function() {
15
- var limitPaginationItems;
21
+ var equalizeColumns, limitPaginationItems;
16
22
 
17
23
  $(document).ready(function() {
18
- var delay;
24
+ var delay, dropdown, menu, navitem;
25
+ equalizeColumns();
19
26
  delay = '';
20
- $('nav > ul > li.menu').on({
27
+ navitem = $('nav > ul > li');
28
+ navitem.find('>a').on({
29
+ focus: function(e) {
30
+ $('nav > ul > li').removeClass('on');
31
+ return $('nav > ul > li > ul').hide();
32
+ }
33
+ });
34
+ menu = $('nav > ul > li.menu');
35
+ menu.on({
21
36
  mouseenter: function(e) {
22
37
  if ($(window).width() > 768) {
23
38
  clearTimeout(delay);
@@ -59,6 +74,39 @@
59
74
  }
60
75
  }
61
76
  });
77
+ menu.find('>a').on({
78
+ focus: function() {
79
+ return $(this).parent('li.menu').trigger('mouseenter');
80
+ }
81
+ });
82
+ menu.find('li:last-child > a').on({
83
+ blur: function() {
84
+ return $(this).closest('li.menu').trigger('mouseleave');
85
+ }
86
+ });
87
+ dropdown = $('.dropdown');
88
+ dropdown.on({
89
+ focus: function() {
90
+ return $(this).addClass('on');
91
+ }
92
+ });
93
+ dropdown.find('li:last-child a').on({
94
+ blur: function() {
95
+ return dropdown.filter('.on').removeClass('on');
96
+ }
97
+ });
98
+ $('body').on('click', function(e) {
99
+ if ($(e.target).hasClass('dropdown')) {
100
+ $(e.target).toggleClass('on');
101
+ } else {
102
+ if (dropdown.filter('.on').length) {
103
+ dropdown.filter('.on').removeClass('on');
104
+ }
105
+ }
106
+ if (navitem.filter('.menu.on').length) {
107
+ return navitem.filter('.menu.on').removeClass('on');
108
+ }
109
+ });
62
110
  limitPaginationItems();
63
111
  $('.pagination ul > li:not(.next, .prev) a').on('click', (function(e) {
64
112
  $('.pagination ul > li:not(.next, .prev)').removeClass('active');
@@ -136,13 +184,15 @@
136
184
  }
137
185
  }
138
186
  });
139
- $('.tabs > ul > li > a').not('.disabled').on('click', function(e) {
187
+ $('.tabs > ul > li > a[href^=#]').on('click', function(e) {
140
188
  var tabs;
141
- tabs = $(this).parents('.tabs');
142
- tabs.find('> ul li a').removeClass('active');
143
- $(this).addClass('active');
144
- tabs.children('div').removeClass('active');
145
- tabs.children($(this).attr('href')).addClass('active');
189
+ if (!$(this).hasClass('disabled')) {
190
+ tabs = $(this).parents('.tabs');
191
+ tabs.find('> ul li a').removeClass('active');
192
+ $(this).addClass('active');
193
+ tabs.children('div').removeClass('active');
194
+ tabs.children($(this).attr('href')).addClass('active');
195
+ }
146
196
  e.preventDefault();
147
197
  return false;
148
198
  });
@@ -181,12 +231,9 @@
181
231
  return $('div.modal').modal();
182
232
  });
183
233
 
184
- $(window).load(function() {
185
- return $('.slider').orbit();
186
- });
187
-
188
234
  $(window).resize(function() {
189
- return limitPaginationItems();
235
+ limitPaginationItems();
236
+ return equalizeColumns();
190
237
  });
191
238
 
192
239
  limitPaginationItems = function() {
@@ -222,6 +269,30 @@
222
269
  });
223
270
  };
224
271
 
272
+ equalizeColumns = function() {
273
+ return $('.row.equalize').each(function() {
274
+ var $row, collapsed, tallest;
275
+ $row = $(this);
276
+ tallest = 0;
277
+ collapsed = false;
278
+ $(this).children('*').each(function(i) {
279
+ $(this).css('min-height', '0');
280
+ collapsed = $(this).outerWidth() === $row.outerWidth();
281
+ if (!collapsed) {
282
+ if (!$(this).hasClass('equal')) {
283
+ $(this).addClass('equal');
284
+ }
285
+ if ($(this).outerHeight() > tallest) {
286
+ return tallest = $(this).outerHeight();
287
+ }
288
+ }
289
+ });
290
+ if (!collapsed) {
291
+ return $(this).children('*').css('min-height', tallest);
292
+ }
293
+ });
294
+ };
295
+
225
296
  /* --------------------------------------------
226
297
  Begin jquery.tooltip.coffee
227
298
  --------------------------------------------
@@ -499,10 +570,12 @@
499
570
  elems = [];
500
571
  $.fn.modal = function() {
501
572
  this.each(function() {
573
+ var $this;
502
574
  $(this).not('#iframeModal').wrapInner('<div class="modal-content"></div>');
503
575
  $(this).prepend('<i class="close icon-remove"></i>').prepend('<i class="fullscreen icon-resize-full"></i>').appendTo('body');
576
+ $this = $(this);
504
577
  return $('[href=#' + $(this).attr('id') + ']').on("click", function(e) {
505
- modals.open($(this).attr('href'));
578
+ modals.open($(this).attr('href'), $(this).hasClass('fullscreen'));
506
579
  e.preventDefault();
507
580
  return false;
508
581
  });
@@ -516,14 +589,14 @@
516
589
  };
517
590
  modals = (function() {
518
591
  var close, fullscreen, open;
519
- $('html').addClass('modal-ready');
592
+ $('body').addClass('modal-ready');
520
593
  if ($("#overlay").length < 1) {
521
594
  $('body').append('<div id="overlay"></div>');
522
595
  }
523
596
  $('#overlay, div.modal .close').bind("click", function(e) {
524
597
  return close();
525
598
  });
526
- open = function(elem) {
599
+ open = function(elem, fullscreen) {
527
600
  $(window).bind("keydown", function(e) {
528
601
  var keyCode;
529
602
  keyCode = (e.which ? e.which : e.keyCode);
@@ -548,17 +621,20 @@
548
621
  'margin-left': ($(elem).outerWidth() / -2) + 'px'
549
622
  });
550
623
  setTimeout(function() {
551
- return $('html').addClass("modal-active");
624
+ return $('body').addClass("modal-active");
552
625
  }, 0);
553
626
  setTimeout(function() {
554
- return $('html').removeClass('modal-ready');
627
+ return $('body').removeClass('modal-ready');
555
628
  }, 400);
629
+ if (fullscreen) {
630
+ modals.fullscreen(elem);
631
+ }
556
632
  };
557
633
  close = function() {
558
634
  var modal;
559
635
  modal = $('div.modal.active');
560
636
  $(window).unbind("keydown");
561
- $('html').removeClass("modal-active").addClass('modal-ready');
637
+ $('body').removeClass("modal-active").addClass('modal-ready');
562
638
  if (modal.hasClass('iframe')) {
563
639
  $('div#iframeModal iframe').replaceWith('<iframe marginheight="0" marginwidth="0" frameborder="0"></iframe>');
564
640
  modal.css({
@@ -15,9 +15,17 @@
15
15
  var limitPaginationItems;
16
16
 
17
17
  $(document).ready(function() {
18
- var delay;
18
+ var delay, dropdown, menu, navitem;
19
19
  delay = '';
20
- $('nav > ul > li.menu').on({
20
+ navitem = $('nav > ul > li');
21
+ navitem.find('>a').on({
22
+ focus: function(e) {
23
+ $('nav > ul > li').removeClass('on');
24
+ return $('nav > ul > li > ul').hide();
25
+ }
26
+ });
27
+ menu = $('nav > ul > li.menu');
28
+ menu.on({
21
29
  mouseenter: function(e) {
22
30
  if ($(window).width() > 768) {
23
31
  clearTimeout(delay);
@@ -59,6 +67,39 @@
59
67
  }
60
68
  }
61
69
  });
70
+ menu.find('>a').on({
71
+ focus: function() {
72
+ return $(this).parent('li.menu').trigger('mouseenter');
73
+ }
74
+ });
75
+ menu.find('li:last-child > a').on({
76
+ blur: function() {
77
+ return $(this).closest('li.menu').trigger('mouseleave');
78
+ }
79
+ });
80
+ dropdown = $('.dropdown');
81
+ dropdown.on({
82
+ focus: function() {
83
+ return $(this).addClass('on');
84
+ }
85
+ });
86
+ dropdown.find('li:last-child a').on({
87
+ blur: function() {
88
+ return dropdown.filter('.on').removeClass('on');
89
+ }
90
+ });
91
+ $('body').on('click', function(e) {
92
+ if ($(e.target).hasClass('dropdown')) {
93
+ $(e.target).toggleClass('on');
94
+ } else {
95
+ if (dropdown.filter('.on').length) {
96
+ dropdown.filter('.on').removeClass('on');
97
+ }
98
+ }
99
+ if (navitem.filter('.menu.on').length) {
100
+ return navitem.filter('.menu.on').removeClass('on');
101
+ }
102
+ });
62
103
  limitPaginationItems();
63
104
  $('.pagination ul > li:not(.next, .prev) a').on('click', (function(e) {
64
105
  $('.pagination ul > li:not(.next, .prev)').removeClass('active');
@@ -136,13 +177,15 @@
136
177
  }
137
178
  }
138
179
  });
139
- $('.tabs > ul > li > a').not('.disabled').on('click', function(e) {
180
+ $('.tabs > ul > li > a[href^=#]').on('click', function(e) {
140
181
  var tabs;
141
- tabs = $(this).parents('.tabs');
142
- tabs.find('> ul li a').removeClass('active');
143
- $(this).addClass('active');
144
- tabs.children('div').removeClass('active');
145
- tabs.children($(this).attr('href')).addClass('active');
182
+ if (!$(this).hasClass('disabled')) {
183
+ tabs = $(this).parents('.tabs');
184
+ tabs.find('> ul li a').removeClass('active');
185
+ $(this).addClass('active');
186
+ tabs.children('div').removeClass('active');
187
+ tabs.children($(this).attr('href')).addClass('active');
188
+ }
146
189
  e.preventDefault();
147
190
  return false;
148
191
  });
@@ -181,10 +224,6 @@
181
224
  return $('div.modal').modal();
182
225
  });
183
226
 
184
- $(window).load(function() {
185
- return $('.slider').orbit();
186
- });
187
-
188
227
  $(window).resize(function() {
189
228
  return limitPaginationItems();
190
229
  });
@@ -0,0 +1,67 @@
1
+ /*! caption2 plugin for Cycle2; version: 20130306 */
2
+ (function($) {
3
+ "use strict";
4
+
5
+ $.extend($.fn.cycle.defaults, {
6
+ captionFxOut: 'fadeOut',
7
+ captionFxIn: 'fadeIn',
8
+ captionFxSel: undefined,
9
+ overlayFxOut: 'fadeOut',
10
+ overlayFxIn: 'fadeIn',
11
+ overlayFxSel: undefined
12
+ });
13
+
14
+ $(document).on( 'cycle-bootstrap', function(e, opts) {
15
+ opts.container.on( 'cycle-update-view-before', update );
16
+ opts.container.one( 'cycle-update-view-after', init );
17
+ });
18
+
19
+ function update( e, opts, slideOpts, currSlide, isAfter ) {
20
+ if ( opts.captionPlugin !== 'caption2' )
21
+ return;
22
+ $.each(['caption','overlay'], function() {
23
+ var fxBase = this + 'Fx',
24
+ fx = opts[fxBase + 'Out'] || 'hide',
25
+ template = slideOpts[this+'Template'],
26
+ el = opts.API.getComponent( this ),
27
+ sel = opts[fxBase+'Sel'],
28
+ speed = opts.speed,
29
+ animEl;
30
+
31
+ if ( opts.sync )
32
+ speed = speed/2;
33
+
34
+ animEl = sel ? el.find( sel ) : el;
35
+
36
+ if( el.length && template ) {
37
+ if ( fx == 'hide')
38
+ speed = 0;
39
+ animEl[fx]( speed, function() {
40
+ var content = opts.API.tmpl( template, slideOpts, opts, currSlide );
41
+ el.html( content );
42
+ animEl = sel ? el.find( sel ) : el;
43
+ if ( sel )
44
+ animEl.hide();
45
+ fx = opts[ fxBase + 'In'] || 'show';
46
+ animEl[fx]( speed );
47
+ });
48
+ }
49
+ else {
50
+ el.hide();
51
+ }
52
+ });
53
+ }
54
+
55
+ function init( e, opts, slideOpts, currSlide, isAfter ) {
56
+ if ( opts.captionPlugin !== 'caption2' )
57
+ return;
58
+ $.each(['caption','overlay'], function() {
59
+ var template = slideOpts[this+'Template'],
60
+ el = opts.API.getComponent( this );
61
+
62
+ if( el.length && template )
63
+ el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
64
+ });
65
+ }
66
+
67
+ })(jQuery);
@@ -0,0 +1,265 @@
1
+ /*! carousel transition plugin for Cycle2; version: 20130108 */
2
+ (function($) {
3
+ "use strict";
4
+
5
+ $( document ).on('cycle-bootstrap', function( e, opts, API ) {
6
+ if ( opts.fx !== 'carousel' )
7
+ return;
8
+
9
+ API.getSlideIndex = function( el ) {
10
+ var slides = this.opts()._carouselWrap.children();
11
+ var i = slides.index( el );
12
+ return i % slides.length;
13
+ };
14
+
15
+ // override default 'next' function
16
+ API.next = function() {
17
+ var count = opts.reverse ? -1 : 1;
18
+ if ( opts.allowWrap === false && ( opts.currSlide + count ) > opts.slideCount - opts.carouselVisible )
19
+ return;
20
+ opts.API.advanceSlide( count );
21
+ opts.API.trigger('cycle-next', [ opts ]).log('cycle-next');
22
+ };
23
+
24
+ });
25
+
26
+
27
+ $.fn.cycle.transitions.carousel = {
28
+ // transition API impl
29
+ preInit: function( opts ) {
30
+ opts.hideNonActive = false;
31
+
32
+ opts.container.on('cycle-destroyed', $.proxy(this.onDestroy, opts.API));
33
+ // override default API implementation
34
+ opts.API.stopTransition = this.stopTransition;
35
+
36
+ // issue #10
37
+ for (var i=0; i < opts.startingSlide; i++) {
38
+ opts.container.append( opts.slides[0] );
39
+ }
40
+ },
41
+
42
+ // transition API impl
43
+ postInit: function( opts ) {
44
+ var pagerCutoffIndex, wrap;
45
+ var vert = opts.carouselVertical;
46
+ if (opts.carouselVisible && opts.carouselVisible > opts.slideCount)
47
+ opts.carouselVisible = opts.slideCount - 1;
48
+ var visCount = opts.carouselVisible || opts.slides.length;
49
+ var slideCSS = { display: vert ? 'block' : 'inline-block', position: 'static' };
50
+
51
+ // required styles
52
+ opts.container.css({ position: 'relative', overflow: 'hidden' });
53
+ opts.slides.css( slideCSS );
54
+
55
+ opts._currSlide = opts.currSlide;
56
+
57
+ // wrap slides in a div; this div is what is animated
58
+ wrap = $('<div class="cycle-carousel-wrap"></div')
59
+ .prependTo( opts.container )
60
+ .css({ margin: 0, padding: 0, top: 0, left: 0, position: 'absolute' })
61
+ .append( opts.slides );
62
+
63
+ opts._carouselWrap = wrap;
64
+
65
+ if ( !vert )
66
+ wrap.css('white-space', 'nowrap');
67
+
68
+ if ( opts.allowWrap !== false ) {
69
+ // prepend and append extra slides so we don't see any empty space when we
70
+ // near the end of the carousel. for fluid containers, add even more clones
71
+ // so there is plenty to fill the screen
72
+ // @todo: optimzie this based on slide sizes
73
+ opts.slides.slice(0, opts.slideCount).clone().css( slideCSS ).appendTo( wrap );
74
+ if ( opts.carouselVisible === undefined )
75
+ opts.slides.slice(0, opts.slideCount).clone().css( slideCSS ).appendTo( wrap );
76
+ opts.slides.slice(0, opts.slideCount).clone().css( slideCSS ).prependTo( wrap );
77
+ if ( opts.carouselVisible === undefined )
78
+ opts.slides.slice(0, opts.slideCount).clone().css( slideCSS ).prependTo( wrap );
79
+
80
+ wrap.find('.cycle-slide-active').removeClass('cycle-slide-active');
81
+ opts.slides.eq(opts.startingSlide).addClass('cycle-slide-active');
82
+ }
83
+
84
+ if ( opts.pager && opts.allowWrap === false ) {
85
+ // hide "extra" pagers
86
+ pagerCutoffIndex = opts.slideCount - visCount;
87
+ $( opts.pager ).children().filter( ':gt('+pagerCutoffIndex+')' ).hide();
88
+ }
89
+
90
+ opts._nextBoundry = opts.slideCount - opts.carouselVisible;
91
+
92
+ this.prepareDimensions( opts );
93
+ },
94
+
95
+ prepareDimensions: function( opts ) {
96
+ var dim, offset, pagerCutoffIndex, tmp;
97
+ var vert = opts.carouselVertical;
98
+ var visCount = opts.carouselVisible || opts.slides.length;
99
+
100
+ if ( opts.carouselFluid && opts.carouselVisible ) {
101
+ if ( ! opts._carouselResizeThrottle ) {
102
+ // fluid container AND fluid slides; slides need to be resized to fit container
103
+ this.fluidSlides( opts );
104
+ }
105
+ }
106
+ else if ( opts.carouselVisible && opts.carouselSlideDimension ) {
107
+ dim = visCount * opts.carouselSlideDimension;
108
+ opts.container[ vert ? 'height' : 'width' ]( dim );
109
+ }
110
+ else if ( opts.carouselVisible ) {
111
+ dim = visCount * $(opts.slides[0])[vert ? 'outerHeight' : 'outerWidth'](true);
112
+ opts.container[ vert ? 'height' : 'width' ]( dim );
113
+ }
114
+ // else {
115
+ // // fluid; don't size the container
116
+ // }
117
+
118
+ offset = ( opts.carouselOffset || 0 );
119
+ if ( opts.allowWrap !== false ) {
120
+ if ( opts.carouselSlideDimension ) {
121
+ offset -= ( (opts.slideCount + opts.currSlide) * opts.carouselSlideDimension );
122
+ }
123
+ else {
124
+ // calculate offset based on actual slide dimensions
125
+ tmp = opts._carouselWrap.children();
126
+ for (var j=0; j < (opts.slideCount + opts.currSlide); j++) {
127
+ offset -= $(tmp[j])[vert?'outerHeight':'outerWidth'](true);
128
+ }
129
+ }
130
+ }
131
+
132
+ opts._carouselWrap.css( vert ? 'top' : 'left', offset );
133
+ },
134
+
135
+ fluidSlides: function( opts ) {
136
+ var timeout;
137
+ var slide = opts.slides.eq(0);
138
+ var adjustment = slide.outerWidth() - slide.width();
139
+ var prepareDimensions = this.prepareDimensions;
140
+
141
+ // throttle resize event
142
+ $(window).on( 'resize', resizeThrottle);
143
+
144
+ opts._carouselResizeThrottle = resizeThrottle;
145
+ onResize();
146
+
147
+ function resizeThrottle() {
148
+ clearTimeout( timeout );
149
+ timeout = setTimeout( onResize, 20 );
150
+ }
151
+
152
+ function onResize() {
153
+ opts._carouselWrap.stop( false, true );
154
+ var slideWidth = opts.container.width() / opts.carouselVisible;
155
+ slideWidth = Math.ceil( slideWidth - adjustment );
156
+ opts._carouselWrap.children().width( slideWidth );
157
+ if ( opts._sentinel )
158
+ opts._sentinel.width( slideWidth );
159
+ prepareDimensions( opts );
160
+ }
161
+ },
162
+
163
+ // transition API impl
164
+ transition: function( opts, curr, next, fwd, callback ) {
165
+ var moveBy, props = {};
166
+ var hops = opts.nextSlide - opts.currSlide;
167
+ var vert = opts.carouselVertical;
168
+ var speed = opts.speed;
169
+
170
+ // handle all the edge cases for wrapping & non-wrapping
171
+ if ( opts.allowWrap === false ) {
172
+ fwd = hops > 0;
173
+ var currSlide = opts._currSlide;
174
+ var maxCurr = opts.slideCount - opts.carouselVisible;
175
+ if ( hops > 0 && opts.nextSlide > maxCurr && currSlide == maxCurr ) {
176
+ hops = 0;
177
+ }
178
+ else if ( hops > 0 && opts.nextSlide > maxCurr ) {
179
+ hops = opts.nextSlide - currSlide - (opts.nextSlide - maxCurr);
180
+ }
181
+ else if ( hops < 0 && opts.currSlide > maxCurr && opts.nextSlide > maxCurr ) {
182
+ hops = 0;
183
+ }
184
+ else if ( hops < 0 && opts.currSlide > maxCurr ) {
185
+ hops += opts.currSlide - maxCurr;
186
+ }
187
+ else
188
+ currSlide = opts.currSlide;
189
+
190
+ moveBy = this.getScroll( opts, vert, currSlide, hops );
191
+ opts.API.opts()._currSlide = opts.nextSlide > maxCurr ? maxCurr : opts.nextSlide;
192
+ }
193
+ else {
194
+ if ( fwd && opts.nextSlide === 0 ) {
195
+ // moving from last slide to first
196
+ moveBy = this.getDim( opts, opts.currSlide, vert );
197
+ callback = this.genCallback( opts, fwd, vert, callback );
198
+ }
199
+ else if ( !fwd && opts.nextSlide == opts.slideCount - 1 ) {
200
+ // moving from first slide to last
201
+ moveBy = this.getDim( opts, opts.currSlide, vert );
202
+ callback = this.genCallback( opts, fwd, vert, callback );
203
+ }
204
+ else {
205
+ moveBy = this.getScroll( opts, vert, opts.currSlide, hops );
206
+ }
207
+ }
208
+
209
+ props[ vert ? 'top' : 'left' ] = fwd ? ( "-=" + moveBy ) : ( "+=" + moveBy );
210
+
211
+ // throttleSpeed means to scroll slides at a constant rate, rather than
212
+ // a constant speed
213
+ if ( opts.throttleSpeed )
214
+ speed = (moveBy / $(opts.slides[0])[vert ? 'height' : 'width']() ) * opts.speed;
215
+
216
+ opts._carouselWrap.animate( props, speed, opts.easing, callback );
217
+ },
218
+
219
+ getDim: function( opts, index, vert ) {
220
+ var slide = $( opts.slides[index] );
221
+ return slide[ vert ? 'outerHeight' : 'outerWidth'](true);
222
+ },
223
+
224
+ getScroll: function( opts, vert, currSlide, hops ) {
225
+ var i, moveBy = 0;
226
+
227
+ if (hops > 0) {
228
+ for (i=currSlide; i < currSlide+hops; i++)
229
+ moveBy += this.getDim( opts, i, vert);
230
+ }
231
+ else {
232
+ for (i=currSlide; i > currSlide+hops; i--)
233
+ moveBy += this.getDim( opts, i, vert);
234
+ }
235
+ return moveBy;
236
+ },
237
+
238
+ genCallback: function( opts, fwd, vert, callback ) {
239
+ // returns callback fn that resets the left/top wrap position to the "real" slides
240
+ return function() {
241
+ var pos = $(opts.slides[opts.nextSlide]).position();
242
+ var offset = 0 - pos[vert?'top':'left'] + (opts.carouselOffset || 0);
243
+ opts._carouselWrap.css( opts.carouselVertical ? 'top' : 'left', offset );
244
+ callback();
245
+ };
246
+ },
247
+
248
+ // core API override
249
+ stopTransition: function() {
250
+ var opts = this.opts();
251
+ opts.slides.stop( false, true );
252
+ opts._carouselWrap.stop( false, true );
253
+ },
254
+
255
+ // core API supplement
256
+ onDestroy: function( e ) {
257
+ var opts = this.opts();
258
+ if ( opts._carouselResizeThrottle )
259
+ $( window ).off( 'resize', opts._carouselResizeThrottle );
260
+ opts.slides.prependTo( opts.container );
261
+ opts._carouselWrap.remove();
262
+ }
263
+ };
264
+
265
+ })(jQuery);