c3bb6278b5
Completed the templates, added a cool javascript effect on textarea (added jquery.ns-autogrow plugin), modified the click functions from .on to .click for improved performance
38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
(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); |