var fid;
/* JANAS AJAX FUNCTIONS ================================================ */
// History
function projects(uid) {
if (uid !== 'about') {
$.ajax({
url: '/' + uid, // url: 'http://localhost/~jensschnitzler/' + uid,
type: 'POST',
success: function(response) {
$('.interview-container').html(response);
$('.interview-container').removeClass('hidden');
$('#separator').removeClass('hidden');
classyLinks(); // adds classes to internal and external links in interviews -> see "classy-links.js"
if (fid){
$('.interview-container').animate({
scrollTop: $('#' + fid).offset().top
}, 300);
}
},
error: function() {
console.log('ajax error');
}
});
}
}
$('.nav-question a').click(function(e) {
closeTopics();
var anchor = $(this);
if (anchor.attr('href').indexOf('http') == -1) {
openAnswer(anchor);
} else {
e.preventDefault();
var myURL = anchor.attr('href').split('#')[0]; // "split('#')[0]" -> split string into array at "#" and take first array element
var myID = anchor.attr('href').split('#')[1];
fid = anchor.attr('href').split('#')[1];
push(myURL);
}
});