2 Deck JS - deck.scale - v1.0
3 Copyright (c) 2011 Caleb Troughton
4 Dual licensed under the MIT license and GPL license.
5 https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6 https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
12 (function($, deck, window, undefined) {
18 scaleDeck = function() {
19 var obh = $[deck]('getOptions').baseHeight,
20 container = $[deck]('getContainer'),
22 slides = $[deck]('getSlides'),
25 // Use tallest slide as base height if not set manually
26 baseHeight = obh ? obh : (function() {
29 $.each(slides, function(i, $slide) {
30 greatest = Math.max(greatest, $slide.outerHeight());
36 scale = height / baseHeight;
38 if (!$[deck]('getOptions').scaleUp && scale > 1) {
42 $.each('Webkit Moz O ms Khtml'.split(' '), function(i, prefix) {
43 container.css(prefix + 'Transform', 'scale(' + scale + ')');
48 Extends defaults/options.
52 $.extend(true, $[deck].defaults, {
61 $d.bind('deck.init', function() {
62 // Only care about scaling non-embedded presentations
63 if (!$[deck]('getContainer').is('body')) return;
65 $[deck]('getContainer').addClass($[deck]('getOptions').classes.scale);
67 // Throttle scaling on resize
68 $w.unbind('resize.deckscale').bind('resize.deckscale', function() {
71 window.setTimeout(function() {
74 }, $[deck]('getOptions').scaleThrottle);
77 // Scale once on load, in case images or something change layout
78 .unbind('load.deckscale').bind('load.deckscale', scaleDeck);
84 // Scale again on load, in case images or anything else changed layout
85 })(jQuery, 'deck', this);