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

79 lines
1.8 KiB
JavaScript
Raw Normal View History

$(function(){
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
2011-07-02 06:37:12 +02:00
// Hide the Mobile Safari address bar once loaded
// ==============================================
// Set a timeout...
// setTimeout(function(){
// // Hide the address bar!
// window.scrollTo(0, 1);
// }, 0);
// table sort example
2011-07-02 06:37:12 +02:00
// ==================
// make code pretty
2011-12-23 04:17:41 +01:00
window.prettyPrint && prettyPrint()
// table sort example
if ($.fn.tableSorter) {
$("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
}
2011-07-02 06:37:12 +02:00
// add on logic
$('.add-on :checkbox').on('click', function () {
var $this = $(this)
, method = $this.attr('checked') ? 'addClass' : 'removeClass'
$(this).parents('.add-on')[method]('active')
})
2011-07-02 06:30:12 +02:00
// Disable certain links in docs
// 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
$('[href^=#]').click(function (e) {
e.preventDefault()
})
// Copy code blocks in docs
$(".copy-code").on('focus', function () {
var el = this
setTimeout(function () { $(el).select() }, 0)
})
if ($.fn.twipsy) {
// position static twipsies for components page
if ($(".twipsies a").length) {
$(window).on('load resize', function () {
$(".twipsies a").each(function () {
$(this)
.twipsy({
placement: $(this).attr('title')
, trigger: 'manual'
})
.twipsy('show')
})
})
}
// add tipsies to grid for scaffolding
if ($('#grid-system').length) {
$('#grid-system').twipsy({
selector: '.show-grid > div'
, title: function () { return $(this).width() + 'px' }
})
}
}
})