Files
kabano/public/views/js/d.header.js
copilot-swe-agent[bot] 7f0143604c Add comments to PHP and JS files
Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
2026-01-24 15:11:48 +00:00

99 lines
2.1 KiB
JavaScript
Executable File

// Gestion des animations du header en scroll.
var small = 2;
function reduce() {
// Réduit la hauteur du header.
$( "header" ).animate({
height: "45px"
}, 100, function() {
// Animation complete.
});
$( "header #logo img" ).animate({
height: "34px"
}, 100, function() {
// Animation complete.
});
$( "header #logo" ).animate({
paddingTop: "3px"
}, 100, function() {
// Animation complete.
});
$( "header li.on-bar" ).animate({
height: "45px"
}, 100, function() {
// Animation complete.
});
$( "header li:not(.with-subtitle) a.on-bar" ).animate({
paddingTop: "15px",
paddingBottom: "5px"
}, 100, function() {
// Animation complete.
});
$( "header li.with-subtitle a.on-bar" ).animate({
paddingTop: "5px",
paddingBottom: "15px"
}, 100, function() {
// Animation complete.
});
}
function enlarge() {
// Restaure la taille du header.
$( "header" ).animate({
height: "65px"
}, 100, function() {
// Animation complete.
});
$( "header #logo img" ).animate({
height: "44px"
}, 100, function() {
// Animation complete.
});
$( "header #logo" ).animate({
paddingTop: "8px"
}, 100, function() {
// Animation complete.
});
$( "header li.on-bar" ).animate({
height: "65px"
}, 100, function() {
// Animation complete.
});
$( "header li:not(.with-subtitle) a.on-bar" ).animate({
paddingTop: "25px",
paddingBottom: "15px"
}, 100, function() {
// Animation complete.
});
$( "header li.with-subtitle a.on-bar" ).animate({
paddingTop: "15px",
paddingBottom: "25px"
}, 100, function() {
// Animation complete.
});
}
// Déclenche les animations selon le scroll.
$(window).scroll(function() {
var position = $(window).scrollTop();
if (position>80 && small!=1 && $('body').width() > 800) {
small = 1;
reduce();
}
else if (position<=80 && small!=0 && $('body').width() > 800) {
small = 0;
enlarge();
}
});
// Affichage du texte du logo au survol.
$(window).ready(function() {
$( "#logo" ).hover(
function() {
$("#kabanologotext").show(100);
}, function() {
$("#kabanologotext").hide(100);
}
)
});