Browse Source

Tweak caption width to fix shadow weirdness when caption text is wider than the width of the media asset.

pull/177/head
Zach Wise 13 years ago
parent
commit
d74665e03f
  1. 68
      source/js/Slider/VMM.Slider.js

68
source/js/Slider/VMM.Slider.js

@ -320,37 +320,38 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* SIZE SLIDES /* SIZE SLIDES
================================================== */ ================================================== */
var sizeSlides = function() { var sizeSlides = function() {
var layout_text_media = ".slider-item .layout-text-media .media .media-container "; var layout_text_media = ".slider-item .layout-text-media .media .media-container ",
var layout_media = ".slider-item .layout-media .media .media-container "; layout_media = ".slider-item .layout-media .media .media-container ",
var layout_both = ".slider-item .media .media-container"; layout_both = ".slider-item .media .media-container",
var mediasize = { layout_caption = ".slider-item .media .media-container .media-shadow .caption",
text_media: { mediasize = {
width: (config.slider.content.width/100) * 60, text_media: {
height: config.slider.height - 60, width: (config.slider.content.width/100) * 60,
video: { height: config.slider.height - 60,
width: 0, video: {
height: 0 width: 0,
height: 0
},
text: {
width: ((config.slider.content.width/100) * 40) - 30,
height: config.slider.height
}
}, },
text: { media: {
width: ((config.slider.content.width/100) * 40) - 30, width: config.slider.content.width,
height: config.slider.height height: config.slider.height - 110,
video: {
width: 0,
height: 0
}
} }
}, };
media: {
width: config.slider.content.width,
height: config.slider.height - 110,
video: {
width: 0,
height: 0
}
}
}
VMM.master_config.sizes.api.width = mediasize.media.width; VMM.master_config.sizes.api.width = mediasize.media.width;
VMM.master_config.sizes.api.height = mediasize.media.height; VMM.master_config.sizes.api.height = mediasize.media.height;
mediasize.text_media.video = VMM.Util.ratio.fit(mediasize.text_media.width, mediasize.text_media.height, 16, 9); mediasize.text_media.video = VMM.Util.ratio.fit(mediasize.text_media.width, mediasize.text_media.height, 16, 9);
mediasize.media.video = VMM.Util.ratio.fit(mediasize.media.width, mediasize.media.height, 16, 9); mediasize.media.video = VMM.Util.ratio.fit(mediasize.media.width, mediasize.media.height, 16, 9);
VMM.Lib.css(".slider-item", "width", config.slider.content.width ); VMM.Lib.css(".slider-item", "width", config.slider.content.width );
VMM.Lib.height(".slider-item", config.slider.height); VMM.Lib.height(".slider-item", config.slider.height);
@ -464,6 +465,10 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Lib.width( layout_media + ".plain-text-quote", mediasize.media.width); VMM.Lib.width( layout_media + ".plain-text-quote", mediasize.media.width);
VMM.Lib.width( layout_media + ".plain-text", mediasize.media.width); VMM.Lib.width( layout_media + ".plain-text", mediasize.media.width);
// CAPTION WIDTH
VMM.Lib.css( layout_text_media + ".caption", "max-width", mediasize.text_media.video.width);
VMM.Lib.css( layout_media + ".caption", "max-width", mediasize.media.video.width);
// MAINTAINS VERTICAL CENTER IF IT CAN // MAINTAINS VERTICAL CENTER IF IT CAN
for(var i = 0; i < slides.length; i++) { for(var i = 0; i < slides.length; i++) {
@ -585,7 +590,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Lib.css(".slider", "overflow-y", "scroll" ); VMM.Lib.css(".slider", "overflow-y", "scroll" );
} else { } else {
VMM.Lib.css(layout, "overflow-y", "hidden" ); VMM.Lib.css(layout, "overflow-y", "hidden" );
VMM.Lib.animate(layout, _duration, _ease, {scrollTop: VMM.Lib.prop(layout, "scrollHeight") - VMM.Lib.height(layout) }); var scroll_height = 0;
try {
scroll_height = VMM.Lib.prop(layout, "scrollHeight");
VMM.Lib.animate(layout, _duration, _ease, {scrollTop: scroll_height - VMM.Lib.height(layout) });
}
catch(err) {
scroll_height = VMM.Lib.height(layout);
}
} }
preloadSlides(); preloadSlides();

Loading…
Cancel
Save