2011-05-04 03:12:43 +02:00
|
|
|
$(document).ready(function(){
|
2011-05-05 09:59:16 +02:00
|
|
|
|
2011-06-28 01:47:12 +02:00
|
|
|
// Example dropdown for topbar nav
|
2011-05-04 03:12:43 +02:00
|
|
|
$("body").bind("click", function(e) {
|
|
|
|
$("ul.menu-dropdown").hide();
|
|
|
|
$('a.menu').parent("li").removeClass("open").children("ul.menu-dropdown").hide();
|
|
|
|
});
|
2011-06-30 22:57:29 +02:00
|
|
|
|
2011-05-04 03:12:43 +02:00
|
|
|
$("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;
|
|
|
|
});
|
2011-05-05 09:59:16 +02:00
|
|
|
|
2011-06-28 01:47:12 +02:00
|
|
|
// table sort example
|
2011-05-05 09:59:16 +02:00
|
|
|
$("#sortTableExample").tablesorter( {sortList: [[1,0]]} );
|
|
|
|
|
2011-06-28 01:47:12 +02:00
|
|
|
// add on
|
2011-05-05 09:59:16 +02:00
|
|
|
$('.add-on :checkbox').click(function() {
|
|
|
|
if ($(this).attr('checked')) {
|
|
|
|
$(this).parents('.add-on').addClass('active');
|
|
|
|
} else {
|
|
|
|
$(this).parents('.add-on').removeClass('active');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-06-30 19:40:28 +02:00
|
|
|
// Copy code blocks in docs
|
|
|
|
$(".copy-code").focus(function() {
|
|
|
|
$(this).select();
|
|
|
|
});
|
|
|
|
$(".copy-code").mouseup(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2011-06-28 01:47:12 +02:00
|
|
|
// scroll spyer
|
2011-05-05 09:59:16 +02:00
|
|
|
var activeTarget,
|
|
|
|
$window = $(window),
|
|
|
|
position = {},
|
|
|
|
nav = $('body > .topbar li a'),
|
|
|
|
targets = nav.map(function () {
|
|
|
|
return $(this).attr('href');
|
|
|
|
}),
|
|
|
|
offsets = $.map(targets, function (id) {
|
|
|
|
return $(id).offset().top;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function setButton(id) {
|
|
|
|
nav.parent("li").removeClass('active');
|
|
|
|
$(nav[$.inArray(id, targets)]).parent("li").addClass('active');
|
|
|
|
}
|
|
|
|
|
|
|
|
function processScroll(e) {
|
|
|
|
var scrollTop = $window.scrollTop() + 10, i;
|
|
|
|
for (i = offsets.length; i--;) {
|
|
|
|
if (activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1])) {
|
|
|
|
activeTarget = targets[i];
|
|
|
|
setButton(activeTarget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nav.click(function () {
|
|
|
|
processScroll();
|
|
|
|
});
|
|
|
|
|
|
|
|
processScroll();
|
|
|
|
|
|
|
|
$window.scroll(processScroll);
|
2011-05-04 03:12:43 +02:00
|
|
|
});
|