Skip to content

Commit 6edba2e

Browse files
committed
Handles: remove 'Slide'; syncing: move to enable(); add optional argument to _updateHeight
1 parent dc51b0e commit 6edba2e

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-carousel",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"main": ["./jquery.carousel.js"],
55
"author": "Thomas Jaggi",
66
"dependencies": {

jquery.carousel.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
navItemNext: '<button class="' + namespace + '-nav" role="presentation">Show next slide</button>',
2424
counter: '<div class="' + namespace + '-counter" aria-hidden="true" role="presentation">%current% of %total%</div>',
2525
handleContainer: '<div class="' + namespace + '-handles" aria-hidden="true" role="presentation" />',
26-
handleItem: '<button class="' + namespace + '-handle" role="presentation">Slide %index%</div>'
26+
handleItem: '<button class="' + namespace + '-handle" role="presentation">%index%</div>'
2727
},
2828
stateClasses: {
2929
isInitialized: 'is-initialized',
@@ -263,13 +263,6 @@
263263
}, this));
264264
}
265265

266-
// Sync with other carousels
267-
if (this.settings.$syncedCarousels) {
268-
this.$dom.container.on(utils.getNamespacedEvents(syncEvent), $.proxy(function(event, params) {
269-
this.goTo(params.index, false, true);
270-
}, this));
271-
}
272-
273266
// Save instance to data attribute
274267
$dom.container.data(namespace, this);
275268

@@ -416,7 +409,9 @@
416409
setTimeout(function() {
417410
self.$dom.frame.scrollLeft(scrollLeft);
418411

419-
self.goTo(index);
412+
if (index > self.props.currentSlideIndex && index < (self.props.currentSlideIndex + self.props.visibleSlides)) {
413+
self.goTo(index);
414+
}
420415
}, 0);
421416
});
422417
});
@@ -445,6 +440,13 @@
445440
if (!this.settings.layout.fixedHeight) {
446441
this._updateHeight();
447442
}
443+
444+
// Sync with other carousels
445+
if (this.settings.$syncedCarousels) {
446+
this.$dom.container.on(utils.getNamespacedEvents(syncEvent), $.proxy(function(event, params) {
447+
this.goTo(params.index, false, true);
448+
}, this));
449+
}
448450
},
449451

450452
disable: function() {
@@ -986,13 +988,18 @@
986988

987989
// Update slider based on currently visible slides
988990
// TODO: called twice on init
989-
_updateHeight: function() {
991+
_updateHeight: function(targetHeight) {
990992
var minIndex = this.props.currentDomIndex,
991993
maxIndex = minIndex + this.props.visible,
992994
filterSelector = (minIndex > 0) ? ':gt(' + (minIndex - 1) + '):lt(' + this.props.visible + ')' : ':lt(' + (maxIndex) + ')',
993995
maxHeight = this._getHighestSlide(),
994996
height = this._getHighestSlide(filterSelector);
995997

998+
if (targetHeight) {
999+
height = targetHeight;
1000+
maxHeight = '100em';
1001+
}
1002+
9961003
this.$dom.slides.css('min-height', maxHeight);
9971004

9981005
this.$dom.frame.animate({

jquery.carousel.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ $carouselColorDisabled: #999 !default;
2323
.is-initialized & {
2424
list-style: none;
2525
margin: 0;
26+
overflow: hidden;
2627
padding: 0;
2728
position: relative;
2829
/* Use GPU */

0 commit comments

Comments
 (0)