info@54: // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT info@54: // IT'S ALL JUST JUNK FOR OUR DOCS! info@54: // ++++++++++++++++++++++++++++++++++++++++++ info@54: info@54: /*! info@54: * Copyright 2013 Twitter, Inc. info@54: * info@54: * Licensed under the Creative Commons Attribution 3.0 Unported License. For info@54: * details, see http://creativecommons.org/licenses/by/3.0/. info@54: */ info@54: info@54: info@54: !function ($) { info@54: info@54: $(function(){ info@54: info@54: // IE10 viewport hack for Surface/desktop Windows 8 bug info@54: // info@54: // See Getting Started docs for more information info@54: if (navigator.userAgent.match(/IEMobile\/10\.0/)) { info@54: var msViewportStyle = document.createElement("style"); info@54: msViewportStyle.appendChild( info@54: document.createTextNode( info@54: "@-ms-viewport{width:auto!important}" info@54: ) info@54: ); info@54: document.getElementsByTagName("head")[0]. info@54: appendChild(msViewportStyle); info@54: } info@54: info@54: info@54: var $window = $(window) info@54: var $body = $(document.body) info@54: info@54: var navHeight = $('.navbar').outerHeight(true) + 10 info@54: info@54: $body.scrollspy({ info@54: target: '.bs-sidebar', info@54: offset: navHeight info@54: }) info@54: info@54: $window.on('load', function () { info@54: $body.scrollspy('refresh') info@54: }) info@54: info@54: $('.bs-docs-container [href=#]').click(function (e) { info@54: e.preventDefault() info@54: }) info@54: info@54: // back to top info@54: setTimeout(function () { info@54: var $sideBar = $('.bs-sidebar') info@54: info@54: $sideBar.affix({ info@54: offset: { info@54: top: function () { info@54: var offsetTop = $sideBar.offset().top info@54: var sideBarMargin = parseInt($sideBar.children(0).css('margin-top'), 10) info@54: var navOuterHeight = $('.bs-docs-nav').height() info@54: info@54: return (this.top = offsetTop - navOuterHeight - sideBarMargin) info@54: } info@54: , bottom: function () { info@54: return (this.bottom = $('.bs-footer').outerHeight(true)) info@54: } info@54: } info@54: }) info@54: }, 100) info@54: info@54: setTimeout(function () { info@54: $('.bs-top').affix() info@54: }, 100) info@54: info@54: // tooltip demo info@54: $('.tooltip-demo').tooltip({ info@54: selector: "[data-toggle=tooltip]", info@54: container: "body" info@54: }) info@54: info@54: $('.tooltip-test').tooltip() info@54: $('.popover-test').popover() info@54: info@54: $('.bs-docs-navbar').tooltip({ info@54: selector: "a[data-toggle=tooltip]", info@54: container: ".bs-docs-navbar .nav" info@54: }) info@54: info@54: // popover demo info@54: $("[data-toggle=popover]") info@54: .popover() info@54: info@54: // button state demo info@54: $('#fat-btn') info@54: .click(function () { info@54: var btn = $(this) info@54: btn.button('loading') info@54: setTimeout(function () { info@54: btn.button('reset') info@54: }, 3000) info@54: }) info@54: }) info@54: info@54: }(jQuery)