0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-02 14:24:19 +01:00
Bootstrap/docs/assets/js/application.js

84 lines
1.9 KiB
JavaScript
Raw Normal View History

$(function(){
// 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();
});
// table sort example
2011-07-02 06:37:12 +02:00
// ==================
$("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
2011-07-02 06:37:12 +02:00
// add on logic
// ============
$('.add-on :checkbox').click(function () {
if ($(this).attr('checked')) {
$(this).parents('.add-on').addClass('active')
} else {
$(this).parents('.add-on').removeClass('active')
}
})
2011-07-02 06:30:12 +02:00
2011-07-02 06:37:12 +02:00
// Disable certain links in docs
2011-07-02 06:37:12 +02:00
// =============================
2011-09-16 18:55:12 +02:00
// 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
2011-07-02 06:37:12 +02:00
$('ul.tabs a, ul.pills a, .pagination a, .well .btn, .actions .btn, .alert-message .btn, a.close').click(function (e) {
e.preventDefault()
})
// Copy code blocks in docs
$(".copy-code").focus(function () {
2011-08-20 05:37:12 +02:00
var el = this;
// push select to event loop for chrome :{o
setTimeout(function () { $(el).select(); }, 1);
});
// POSITION STATIC TWIPSIES
// ========================
$(window).on('load resize', function () {
$(".twipsies a").each(function () {
$(this)
.twipsy({
live: false
, placement: $(this).attr('title')
, trigger: 'manual'
, offset: 2
})
2011-09-12 06:03:17 +02:00
.twipsy('show')
})
})
});