From fbe8bea140924237dd54dc33f22e1687c279435a Mon Sep 17 00:00:00 2001 From: fat Date: Thu, 6 Mar 2014 20:23:53 -0800 Subject: [PATCH] fix docs errors --- docs/assets/js/docs.js | 43 ++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/docs/assets/js/docs.js b/docs/assets/js/docs.js index 902385c..637b14f 100644 --- a/docs/assets/js/docs.js +++ b/docs/assets/js/docs.js @@ -24,23 +24,28 @@ $(function() { var initialize = function () { - currentActive = 0; - topCache = []; - win = $(window); - doc = $(document); - bod = $(document.body); - device = device || $('.js-device'); - navComponentLinks = $('.js-jump-menu'); - componentsList = $('.js-component-group'); - componentLinks = $('.component-example a'); - contentSection = $('.component'); - topCache = contentSection.map(function () { return $(this).offset().top; }); - windowHeight = $(window).height() / 3; - windowWidth = $(window).width(); - pageHeight = $(document).height(); - contentPadding = parseInt($('.docs-content').css('padding-bottom'), 10); - footerHeight = $('.docs-footer').outerHeight(false); - toolbarToggle = $('.js-docs-component-toolbar'); + currentActive = 0; + topCache = []; + win = $(window); + doc = $(document); + bod = $(document.body); + device = device || $('.js-device'); + navComponentLinks = $('.js-jump-menu'); + componentsList = $('.js-component-group'); + componentLinks = $('.component-example a'); + contentSection = $('.component'); + topCache = contentSection.map(function () { return $(this).offset().top; }); + windowHeight = $(window).height() / 3; + windowWidth = $(window).width(); + pageHeight = $(document).height(); + contentPadding = parseInt($('.docs-content').css('padding-bottom'), 10); + footerHeight = $('.docs-footer').outerHeight(false); + toolbarToggle = $('.js-docs-component-toolbar'); + + // exit if no device + if (!device.length) { + return; + } // Device placement if (windowWidth >= 768) { @@ -179,5 +184,7 @@ $(function() { }; $(window).on('load resize', initialize); - $(window).on('load', function () { new FingerBlast('.device-content'); }); + $(window).on('load', function () { + window.FingerBlast && (new FingerBlast('.device-content')); + }); });