if (videojs(id) && videojs(id).isFullscreen()) {
$(this).attr('style', ''); // Clear scaling for fullscreen player
} else {
- $(this).css('fontSize', 12 / fluidbook.resize.bookScale);
+ var scaledFontSize = 12 / fluidbook.resize.bookScale,
+ scaledWidth = $(this).width() * fluidbook.resize.bookScale, // Actual screen width in pixels
+ breakpoint = 400; // Width of player when it should start scaling down all elements as width reduces
+
+ // Sometimes the player might be very small so we need to
+ // scale the font size differently in this case to make it fit
+ if (scaledWidth < breakpoint) {
+ $(this).css('fontSize', scaledFontSize * scaledWidth / breakpoint);
+ } else {
+ $(this).css('fontSize', scaledFontSize);
+ }
+
}
});
},