bootstrap-source/bootstrap-3.0.3/docs-assets/js/application.js
changeset 115 a9d04f5f5650
parent 54 0ded9d7748b7
equal deleted inserted replaced
114:6093dda9fe38 115:a9d04f5f5650
     1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
       
     2 // IT'S ALL JUST JUNK FOR OUR DOCS!
       
     3 // ++++++++++++++++++++++++++++++++++++++++++
       
     4 
       
     5 /*!
       
     6  * Copyright 2013 Twitter, Inc.
       
     7  *
       
     8  * Licensed under the Creative Commons Attribution 3.0 Unported License. For
       
     9  * details, see http://creativecommons.org/licenses/by/3.0/.
       
    10  */
       
    11 
       
    12 
       
    13 !function ($) {
       
    14 
       
    15   $(function(){
       
    16 
       
    17     // IE10 viewport hack for Surface/desktop Windows 8 bug
       
    18     //
       
    19     // See Getting Started docs for more information
       
    20     if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
       
    21       var msViewportStyle = document.createElement("style");
       
    22       msViewportStyle.appendChild(
       
    23         document.createTextNode(
       
    24           "@-ms-viewport{width:auto!important}"
       
    25         )
       
    26       );
       
    27       document.getElementsByTagName("head")[0].
       
    28         appendChild(msViewportStyle);
       
    29     }
       
    30 
       
    31 
       
    32     var $window = $(window)
       
    33     var $body   = $(document.body)
       
    34 
       
    35     var navHeight = $('.navbar').outerHeight(true) + 10
       
    36 
       
    37     $body.scrollspy({
       
    38       target: '.bs-sidebar',
       
    39       offset: navHeight
       
    40     })
       
    41 
       
    42     $window.on('load', function () {
       
    43       $body.scrollspy('refresh')
       
    44     })
       
    45 
       
    46     $('.bs-docs-container [href=#]').click(function (e) {
       
    47       e.preventDefault()
       
    48     })
       
    49 
       
    50     // back to top
       
    51     setTimeout(function () {
       
    52       var $sideBar = $('.bs-sidebar')
       
    53 
       
    54       $sideBar.affix({
       
    55         offset: {
       
    56           top: function () {
       
    57             var offsetTop      = $sideBar.offset().top
       
    58             var sideBarMargin  = parseInt($sideBar.children(0).css('margin-top'), 10)
       
    59             var navOuterHeight = $('.bs-docs-nav').height()
       
    60 
       
    61             return (this.top = offsetTop - navOuterHeight - sideBarMargin)
       
    62           }
       
    63         , bottom: function () {
       
    64             return (this.bottom = $('.bs-footer').outerHeight(true))
       
    65           }
       
    66         }
       
    67       })
       
    68     }, 100)
       
    69 
       
    70     setTimeout(function () {
       
    71       $('.bs-top').affix()
       
    72     }, 100)
       
    73 
       
    74     // tooltip demo
       
    75     $('.tooltip-demo').tooltip({
       
    76       selector: "[data-toggle=tooltip]",
       
    77       container: "body"
       
    78     })
       
    79 
       
    80     $('.tooltip-test').tooltip()
       
    81     $('.popover-test').popover()
       
    82 
       
    83     $('.bs-docs-navbar').tooltip({
       
    84       selector: "a[data-toggle=tooltip]",
       
    85       container: ".bs-docs-navbar .nav"
       
    86     })
       
    87 
       
    88     // popover demo
       
    89     $("[data-toggle=popover]")
       
    90       .popover()
       
    91 
       
    92     // button state demo
       
    93     $('#fat-btn')
       
    94       .click(function () {
       
    95         var btn = $(this)
       
    96         btn.button('loading')
       
    97         setTimeout(function () {
       
    98           btn.button('reset')
       
    99         }, 3000)
       
   100       })
       
   101 })
       
   102 
       
   103 }(jQuery)
       
Impressum Datenschutzerklärung