application.js 1.89 KB
Newer Older
1
$(function(){
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  // Hide the Mobile Safari address bar once loaded
  // ==============================================

  window.addEventListener("load",function() {
    // Set a timeout...
    setTimeout(function(){
      // Hide the address bar!
      window.scrollTo(0, 1);
    }, 0);
  });


  // Docs topbar nav
  // ===============

  $('.nav .active').click(function(e) {
    e.preventDefault();
    $(this).siblings().toggle();
  });


  // Show grid dimensions on hover
  // =============================

  $('.show-grid > div').hover(function() {
    var width = $(this).width();
    $(this).attr('title', width);
    $(this).twipsy();
  });


34
  // table sort example
Jacob Thornton's avatar
Jacob Thornton committed
35
36
  // ==================

37
  $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
38

Jacob Thornton's avatar
Jacob Thornton committed
39
40
41
42

  // add on logic
  // ============

43
  $('.add-on :checkbox').click(function () {
44
    if ($(this).attr('checked')) {
45
      $(this).parents('.add-on').addClass('active')
46
    } else {
47
      $(this).parents('.add-on').removeClass('active')
48
    }
49
  })
Jacob Thornton's avatar
Jacob Thornton committed
50

Jacob Thornton's avatar
Jacob Thornton committed
51

52
  // Disable certain links in docs
Jacob Thornton's avatar
Jacob Thornton committed
53
  // =============================
54
  // Please do not carry these styles over to your projects, it's merely here to prevent button clicks form taking you away from your spot on page
Jacob Thornton's avatar
Jacob Thornton committed
55

56
57
58
  $('ul.tabs a, ul.pills a, .pagination a, .well .btn, .actions .btn, .alert-message .btn, a.close').click(function (e) {
    e.preventDefault()
  })
59

60
  // Copy code blocks in docs
61
  $(".copy-code").focus(function () {
Jacob Thornton's avatar
Jacob Thornton committed
62
63
64
    var el = this;
    // push select to event loop for chrome :{o
    setTimeout(function () { $(el).select(); }, 1);
65
66
67
  });


68
69
  // POSITION STATIC TWIPSIES
  // ========================
70

71
  $(window).bind( 'load resize', function () {
72
73
74
75
76
77
78
79
    $(".twipsies a").each(function () {
       $(this)
        .twipsy({
          live: false
        , placement: $(this).attr('title')
        , trigger: 'manual'
        , offset: 2
        })
80
        .twipsy('show')
81
      })
82
  })
83
});