1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/chtickynotes_ynh.git synced 2024-09-03 18:15:57 +02:00
chtickynotes_ynh/sources/libs/main.js
Chtixof c63ca08270 Created
Copied from ynh-chtickynotes and begining of boards management
2015-02-26 23:40:40 +01:00

30 lines
949 B
JavaScript

//Navigation menu scroll
$(function() {
$('.navegable').click(function() {
$('#navigation li').removeClass('active');
$(this).parent('li').addClass('active');
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top - 80;
$('html,body').animate({scrollTop: targetOffset}, 1000);
return false;
}
}
});
});
function GetSitePath() {
var rootPath = window.location.protocol + "//" + window.location.host;
var path = window.location.pathname;
if (path.lastIndexOf("/") == 0) {
path = path.substring(1);
}
path = path.substr(0,path.lastIndexOf("/"));
if (path != "") {
rootPath = rootPath + path + '/';
}
return rootPath;
}