$(window).load(function () {
$(".posts img").keepTheRhythm({
baseLine: 30
});
});
var secondaryNav = $('#title-bar'),
secondaryNavTopPosition = $('#navbar').offset().top,
titleContent = $('#title-content'),
mainContent = $('#main-content');
$(window).on('scroll', function(){
if($(window).scrollTop() > secondaryNavTopPosition ) {
secondaryNav.addClass('is-fixed');
titleContent.addClass('is-hidden');
mainContent.addClass('is-shifted');
//setTimeout(function() {
// secondaryNav.addClass('animate-children');
// $('#cd-logo').addClass('slide-in');
// $('.cd-btn').addClass('slide-in');
//}, 50);
} else {
secondaryNav.removeClass('is-fixed');
titleContent.removeClass('is-hidden');
mainContent.removeClass('is-shifted');
//setTimeout(function() {
// secondaryNav.removeClass('animate-children');
// $('#cd-logo').removeClass('slide-in');
// $('.cd-btn').removeClass('slide-in');
//}, 50);
}
});
/*
//call this function once the page has loaded
window.addEventListener('load', snote_init, false);
//window.addEventListener('mousedown', snote_hide, false);
//this function will add a span with snote_tip class where a span with the snote class is used, this reduces the html needed and makes writing notes so much simpler/cleaner.
function snote_init() {
var snote_elements = document.getElementsByClassName('snote');
for (var i = 0; i < snote_elements.length; i += 1) {
(function(i) {
var snote_element = snote_elements[i];
snote_element.innerHTML = '[' + snote_element.title + ']' + '' + snote_element.innerHTML + '';
snote_element.style.display = 'inline-block';
//snote_element.addEventListener ("mouseup", function () {snote_show(i)}, false);
})(i);
}
}
*/
// Replacement for snote_init()
$(window).load(function () {
$('.snote').toggleClass("snote snote_tip").each(function(index) {
$(this).before('[' + $(this).attr('title') + ']');
});
});
// Replacement for snote_hide and snote_show
$(document).on('click', function(event) {
// Handle clicks on snote_refnum's
if (event.target.className == 'snote_refnum') {
// Get the snote_tip adjacent to the snote_refnum
var thisSnoteTip = $(event.target).nextAll('.snote_tip').eq(0);
// Toggle the visibility state of the snote_tip
if (thisSnoteTip.css("visibility") == 'hidden') {
thisSnoteTip.css("visibility","visible");
}
else {
thisSnoteTip.css("visibility","hidden");
}
// If the click wasn't on a number, determine whether the click was on an element (such as a link) inside the tip
// Trigger if we click outside the tip, or on the tip itself, but not on items inside the tip
} else if (event.target.className == 'snote_tip' || !$(event.target).closest('.snote_tip').length) {
// Hide all tooltips
$('.snote_tip').css("visibility","hidden");
}
});