Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion responsiveslides.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,26 @@
.append($slide);
}

// Add ID's to each slide
// Add ID's to each slide and search max height
var maxHeigth = -1;
$slide.each(function (i) {
this.id = slideClassPrefix + i;
$(this).has('p').addClass('with-caption');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May change 'p' element checking to custom variable to make possible to assign custom element as caption.

var itemHeight = $(this).outerHeight();
if( itemHeight > maxHeigth ) maxHeigth = itemHeight;
});

// Add padding to smaller slides
$slide.each(function () {
var item = $(this),
distance = maxHeigth - item.outerHeight();
if(distance > 0){
var paddingValue = distance / 2;
item.css({
"padding-top": paddingValue,
"padding-bottom": paddingValue
});
}
});

// Add max-width and classes
Expand Down