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

5
!function ($) {
6

7
  $(function(){
Jacob Thornton's avatar
Jacob Thornton committed
8

9
    var $window = $(window)
Jacob Thornton's avatar
Jacob Thornton committed
10
    var $body   = $(document.body)
11

fat's avatar
fat committed
12
13
    var navHeight = $('.navbar').outerHeight(true) + 10

Jacob Thornton's avatar
Jacob Thornton committed
14
    $body.scrollspy({
fat's avatar
fat committed
15
16
17
18
      target: '.bs-sidebar',
      offset: navHeight
    })

19
20
21
22
    $window.on('load', function () {
      $body.scrollspy('refresh')
    })

Jacob Thornton's avatar
Jacob Thornton committed
23
    $('.bs-docs-container [href=#]').click(function (e) {
24
25
26
      e.preventDefault()
    })

27
    // back to top
Mark Otto's avatar
Mark Otto committed
28
    setTimeout(function () {
fat's avatar
fat committed
29
30
31
      var $sideBar = $('.bs-sidebar')

      $sideBar.affix({
Mark Otto's avatar
Mark Otto committed
32
        offset: {
fat's avatar
fat committed
33
34
35
36
37
38
39
40
41
42
          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)
          }
        , bottom: function () {
            return (this.bottom = $('.bs-footer').outerHeight(true))
          }
Mark Otto's avatar
Mark Otto committed
43
44
45
        }
      })
    }, 100)
46

47
    setTimeout(function () {
Mark Otto's avatar
Mark Otto committed
48
      $('.bs-top').affix()
49
50
    }, 100)

Jacob Thornton's avatar
Jacob Thornton committed
51
    // tooltip demo
52
    $('.tooltip-demo').tooltip({
53
54
      selector: "[data-toggle=tooltip]",
      container: "body"
Jacob Thornton's avatar
Jacob Thornton committed
55
    })
56

57
58
    $('.tooltip-test').tooltip()
    $('.popover-test').popover()
Jacob Thornton's avatar
Jacob Thornton committed
59

Mark Otto's avatar
Mark Otto committed
60
61
62
63
64
    $('.bs-docs-navbar').tooltip({
      selector: "a[data-toggle=tooltip]",
      container: ".bs-docs-navbar .nav"
    })

Jacob Thornton's avatar
Jacob Thornton committed
65
    // popover demo
66
    $("[data-toggle=popover]")
Jacob Thornton's avatar
Jacob Thornton committed
67
68
69
70
71
72
73
74
75
76
77
78
79
      .popover()

    // button state demo
    $('#fat-btn')
      .click(function () {
        var btn = $(this)
        btn.button('loading')
        setTimeout(function () {
          btn.button('reset')
        }, 3000)
      })

    // carousel demo
80
    $('.bs-docs-carousel-example').carousel()
Jacob Thornton's avatar
Jacob Thornton committed
81
})
82

83
}(window.jQuery)