application.js 1.74 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
    })

Jacob Thornton's avatar
Jacob Thornton committed
19
    $('.bs-docs-container [href=#]').click(function (e) {
20
21
22
      e.preventDefault()
    })

23
    // back to top
Mark Otto's avatar
Mark Otto committed
24
    setTimeout(function () {
fat's avatar
fat committed
25
26
27
      var $sideBar = $('.bs-sidebar')

      $sideBar.affix({
Mark Otto's avatar
Mark Otto committed
28
        offset: {
fat's avatar
fat committed
29
30
31
32
33
34
35
36
37
38
          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
39
40
41
        }
      })
    }, 100)
42

43
    setTimeout(function () {
Mark Otto's avatar
Mark Otto committed
44
      $('.bs-top').affix()
45
46
    }, 100)

Jacob Thornton's avatar
Jacob Thornton committed
47
    // tooltip demo
48
    $('.tooltip-demo').tooltip({
49
      selector: "[data-toggle=tooltip]"
Jacob Thornton's avatar
Jacob Thornton committed
50
    })
51

52
53
    $('.tooltip-test').tooltip()
    $('.popover-test').popover()
Jacob Thornton's avatar
Jacob Thornton committed
54

Mark Otto's avatar
Mark Otto committed
55
56
57
58
59
    $('.bs-docs-navbar').tooltip({
      selector: "a[data-toggle=tooltip]",
      container: ".bs-docs-navbar .nav"
    })

Jacob Thornton's avatar
Jacob Thornton committed
60
    // popover demo
61
    $("[data-toggle=popover]")
Jacob Thornton's avatar
Jacob Thornton committed
62
63
64
65
66
67
68
69
70
71
72
73
74
      .popover()

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

    // carousel demo
75
    $('.bs-docs-carousel-example').carousel()
Jacob Thornton's avatar
Jacob Thornton committed
76
})
77

78
}(window.jQuery)