1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-25 12:59:05 +02:00

resolve merge conflict

This commit is contained in:
Mark Otto
2011-07-01 22:16:29 -07:00
5 changed files with 273 additions and 50 deletions

View File

@@ -1,55 +1,8 @@
$(document).ready(function(){
// Example dropdown for topbar nav
$("body").bind("click", function(e) {
$("ul.menu-dropdown").hide();
$('a.menu').parent("li").removeClass("open").children("ul.menu-dropdown").hide();
});
// scroll spy logic
// ================
$("a.menu").click(function(e) {
var $target = $(this);
var $parent = $target.parent("li");
var $siblings = $target.siblings("ul.menu-dropdown");
var $parentSiblings = $parent.siblings("li");
if ($parent.hasClass("open")) {
$parent.removeClass("open");
$siblings.hide();
} else {
$parent.addClass("open");
$siblings.show();
}
$parentSiblings.children("ul.menu-dropdown").hide();
$parentSiblings.removeClass("open");
return false;
});
// table sort example
$("#sortTableExample").tablesorter( {sortList: [[1,0]]} );
// add on
$('.add-on :checkbox').click(function() {
if ($(this).attr('checked')) {
$(this).parents('.add-on').addClass('active');
} else {
$(this).parents('.add-on').removeClass('active');
}
});
// Disable certain links and buttons in docs
$('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() {
$(this).select();
});
$(".copy-code").mouseup(function(e) {
e.preventDefault();
});
// scroll spyer
var activeTarget,
$window = $(window),
position = {},
@@ -84,4 +37,108 @@ $(document).ready(function(){
processScroll();
$window.scroll(processScroll);
// Dropdown example for topbar nav
// ===============================
$("body").bind("click", function(e) {
$("ul.menu-dropdown").hide();
$('a.menu').parent("li").removeClass("open").children("ul.menu-dropdown").hide();
});
$("a.menu").click(function(e) {
var $target = $(this);
var $parent = $target.parent("li");
var $siblings = $target.siblings("ul.menu-dropdown");
var $parentSiblings = $parent.siblings("li");
if ($parent.hasClass("open")) {
$parent.removeClass("open");
$siblings.hide();
} else {
$parent.addClass("open");
$siblings.show();
}
$parentSiblings.children("ul.menu-dropdown").hide();
$parentSiblings.removeClass("open");
return false;
});
// table sort example
// ==================
$("#sortTableExample").tablesorter( {sortList: [[1,0]]} );
// 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');
}
});
// Disable certain links in docs
// =============================
$('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() {
$(this).select();
});
$(".copy-code").mouseup(function(e) {
e.preventDefault();
});
// POSITION TWIPSIES
// =================
$('.twipsies.well a').each(function () {
var type = this.title
, $anchor = $(this)
, $twipsy = $('.twipsy.' + type)
, twipsy = {
width: $twipsy.width() + 10
, height: $twipsy.height() + 10
}
, anchor = {
position: $anchor.position()
, width: $anchor.width()
, height: $anchor.height()
}
, offset = {
above: {
top: anchor.position.top - twipsy.height
, left: anchor.position.left + (anchor.width/2) - (twipsy.width/2)
}
, below: {
top: anchor.position.top + anchor.height
, left: anchor.position.left + (anchor.width/2) - (twipsy.width/2)
}
, left: {
top: anchor.position.top + (anchor.height/2) - (twipsy.height/2)
, left: anchor.position.left - twipsy.width - 5
}
, right: {
top: anchor.position.top + (anchor.height/2) - (twipsy.height/2)
, left: anchor.position.left + anchor.width + 5
}
}
$twipsy.css(offset[type])
});
});