application.js 2.06 KB
Newer Older
1
2
3
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
4

5
/*!
6
 * JavaScript for Bootstrap's docs (http://getbootstrap.com)
7
 * Copyright 2011-2014 Twitter, Inc.
8
9
 * Licensed under the Creative Commons Attribution 3.0 Unported License. For
 * details, see http://creativecommons.org/licenses/by/3.0/.
10
11
 */

12

13
!function ($) {
14

15
  $(function () {
Jacob Thornton's avatar
Jacob Thornton committed
16

17
    var $window = $(window)
Jacob Thornton's avatar
Jacob Thornton committed
18
    var $body   = $(document.body)
19

Jacob Thornton's avatar
Jacob Thornton committed
20
    $body.scrollspy({
XhmikosR's avatar
XhmikosR committed
21
      target: '.bs-docs-sidebar'
fat's avatar
fat committed
22
23
    })

24
25
26
27
    $window.on('load', function () {
      $body.scrollspy('refresh')
    })

Jacob Thornton's avatar
Jacob Thornton committed
28
    $('.bs-docs-container [href=#]').click(function (e) {
29
30
31
      e.preventDefault()
    })

32
    // back to top
Mark Otto's avatar
Mark Otto committed
33
    setTimeout(function () {
34
      var $sideBar = $('.bs-docs-sidebar')
fat's avatar
fat committed
35
36

      $sideBar.affix({
Mark Otto's avatar
Mark Otto committed
37
        offset: {
fat's avatar
fat committed
38
39
40
41
42
43
          top: function () {
            var offsetTop      = $sideBar.offset().top
            var sideBarMargin  = parseInt($sideBar.children(0).css('margin-top'), 10)
            var navOuterHeight = $('.bs-docs-nav').height()

            return (this.top = offsetTop - navOuterHeight - sideBarMargin)
44
45
          },
          bottom: function () {
46
            return (this.bottom = $('.bs-docs-footer').outerHeight(true))
fat's avatar
fat committed
47
          }
Mark Otto's avatar
Mark Otto committed
48
49
50
        }
      })
    }, 100)
51

52
    setTimeout(function () {
Mark Otto's avatar
Mark Otto committed
53
      $('.bs-top').affix()
54
55
    }, 100)

Jacob Thornton's avatar
Jacob Thornton committed
56
    // tooltip demo
57
    $('.tooltip-demo').tooltip({
58
      selector: '[data-toggle="tooltip"]',
XhmikosR's avatar
XhmikosR committed
59
      container: 'body'
Jacob Thornton's avatar
Jacob Thornton committed
60
    })
61

62
63
    $('.tooltip-test').tooltip()
    $('.popover-test').popover()
Jacob Thornton's avatar
Jacob Thornton committed
64

Mark Otto's avatar
Mark Otto committed
65
    $('.bs-docs-navbar').tooltip({
66
      selector: 'a[data-toggle="tooltip"]',
XhmikosR's avatar
XhmikosR committed
67
      container: '.bs-docs-navbar .nav'
Mark Otto's avatar
Mark Otto committed
68
69
    })

Jacob Thornton's avatar
Jacob Thornton committed
70
    // popover demo
Mark Otto's avatar
Mark Otto committed
71
72
73
74
75
76
    $('.bs-docs-popover').popover()

    // Popover dismiss on next click
    $('.bs-docs-popover-dismiss').popover({
      trigger: 'focus'
    })
Jacob Thornton's avatar
Jacob Thornton committed
77
78

    // button state demo
79
    $('#loading-example-btn')
Jacob Thornton's avatar
Jacob Thornton committed
80
81
82
83
84
85
86
      .click(function () {
        var btn = $(this)
        btn.button('loading')
        setTimeout(function () {
          btn.button('reset')
        }, 3000)
      })
87
  })
88

Zlatan Vasović's avatar
Zlatan Vasović committed
89
}(jQuery)