0
0
This repository has been archived on 2020-08-03. You can view files and clone it, but cannot push or open issues or pull requests.
bryanpedini.it_old/js/onePageApp-sections-control.js

38 lines
1.5 KiB
JavaScript
Raw Normal View History

(function($) {
function getPageContent (section) {
$.ajax({
url: 'index.php',
method: 'POST',
datatype: 'JSON',
data: {
section: section,
},
success: function (data) {
if ( data.status == 200 ) {
$('#page-title').html(data.pageTitle);
$('#user-content').html(data.html);
}
else {
console.log("[" + data.status + "] " + data.errorCode + ": " + data.errorText);
}
},
error: function (jqXHR, exception) {
console.log(jqXHR.status + ": " + jqXHR.responseText + " | - | " + exception);
},
});
}
$(function() {
$('#navbar-home').click(function () { getPageContent (1) } );
$('#navbar-description').click(function () { getPageContent (2) });
$('#navbar-work').click(function () { getPageContent (3) });
$('#navbar-ideas').click(function () { getPageContent (4) });
$('#navbar-contact-form').click(function () { getPageContent (5) });
$('#navbar-contact-email').click(function () { window.location.href = "mailto:bryanpedini@bryanpedini.it"; });
$('ul.nav li.dropdown').hover(function () {
$(this).find('.dropdown-menu').stop(true, true).fadeIn(500);
}, function () {
$(this).find('.dropdown-menu').stop(true, true).fadeOut(500);
});
getPageContent(0);
});
})(jQuery);