240 lines
6.3 KiB
JavaScript
240 lines
6.3 KiB
JavaScript
/**
|
|
* @file
|
|
* reha behaviors.
|
|
*/
|
|
(function (Drupal) {
|
|
|
|
'use strict';
|
|
|
|
Drupal.behaviors.reha = {
|
|
attach: function (context, settings) {
|
|
|
|
console.log('It works!');
|
|
|
|
}
|
|
};
|
|
|
|
|
|
} (Drupal));
|
|
|
|
jQuery(document).ready(function($){
|
|
|
|
// menu déroulant
|
|
|
|
////////////// contacts ///////
|
|
|
|
$(".bouton-contact").click(function(event) {
|
|
// Fermer .connexion-full s'il est déroulé
|
|
if ($(".connexion-full").is(":visible")) {
|
|
$(".connexion-full").slideUp();
|
|
}
|
|
if ($(".connected-full").is(":visible")) {
|
|
$(".connected-full").slideUp();
|
|
}
|
|
// Ouvrir .contacts-full
|
|
$(".contacts-full").slideToggle();
|
|
|
|
});
|
|
|
|
////////////// connexion ///////
|
|
|
|
$(".bouton-connexion").click(function(event) {
|
|
// Fermer .contacts-full s'il est déroulé
|
|
if ($(".contacts-full").is(":visible")) {
|
|
$(".contacts-full").slideUp();
|
|
}
|
|
// Ouvrir .connexion-full
|
|
$(".connexion-full").slideToggle();
|
|
});
|
|
|
|
$(".bouton-connected").click(function(event) {
|
|
// Fermer .contacts-full s'il est déroulé
|
|
if ($(".contacts-full").is(":visible")) {
|
|
$(".contacts-full").slideUp();
|
|
}
|
|
// Ouvrir .connected-full
|
|
$(".connected-full").slideToggle();
|
|
});
|
|
|
|
$(".titre").click(function(event) {
|
|
if ($(".connected-full").is(":visible")) {
|
|
$(".connected-full").slideUp();
|
|
}
|
|
if ($(".contacts-full").is(":visible")) {
|
|
$(".contacts-full").slideUp();
|
|
}
|
|
if ($(".connexion-full").is(":visible")) {
|
|
$(".connexion-full").slideUp();
|
|
}
|
|
// // Ouvrir .connexion-full
|
|
// $(".connected-full").slideToggle();
|
|
});
|
|
|
|
$("#edit-field-dossier-de-candidature-0--label").click(function(event) {
|
|
event.preventDefault();
|
|
// Ouvrir .connexion-full
|
|
$("#edit-field-dossier-de-candidature-0--description>ul.main").slideToggle();
|
|
});
|
|
|
|
|
|
////////////// tiroir fichiers ///////
|
|
|
|
$(document).ready(function() {
|
|
// Vérifier l'état initial depuis sessionStorage
|
|
if (sessionStorage.getItem('asideOpened') === 'true') {
|
|
$(".layout-sidebar-second").addClass('close');
|
|
$("h2").addClass('__close');
|
|
}
|
|
|
|
$(".profile--type--collaborateur").click(function(event) {
|
|
// Ouvrir .tiroir fichiers
|
|
$(".layout-sidebar-second").addClass('close');
|
|
$("h2").addClass('__close');
|
|
sessionStorage.setItem('asideOpened', 'true');
|
|
});
|
|
|
|
$("#block-reha-views-block-current-user-doc-profile-block-1 > h2").click(function(event) {
|
|
// Fermer .tiroir fichiers
|
|
$(".layout-sidebar-second").removeClass('close');
|
|
$("h2").removeClass('__close');
|
|
sessionStorage.setItem('asideOpened', 'false');
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
|
|
// slideshow home
|
|
|
|
(function($, window) {
|
|
console.log('hello slick')
|
|
$(document).ready(function(){
|
|
$('.view-id-sites.view-display-id-block_1').slick({
|
|
slidesToShow: 1,
|
|
// slidesToScroll: 1,
|
|
dots: false,
|
|
arrows: true,
|
|
centerMode: true,
|
|
adaptiveHeight: true,
|
|
// centerPadding: '100px',
|
|
responsive: [
|
|
{
|
|
breakpoint: 810,
|
|
settings: {
|
|
slidesToShow: 1,
|
|
adaptiveHeight: true,
|
|
arrows: false,
|
|
draggable: true,
|
|
centerMode: true,
|
|
}
|
|
}]
|
|
});
|
|
console.log('salut slick home');
|
|
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$('.view-id-actus.view-display-id-block_1').slick({
|
|
slidesToShow: 3,
|
|
// slidesToScroll: 1,
|
|
dots: false,
|
|
arrows: true,
|
|
centerMode: true,
|
|
// centerPadding: '100px',
|
|
responsive: [
|
|
{
|
|
breakpoint: 810,
|
|
settings: {
|
|
slidesToShow: 1,
|
|
adaptiveHeight: true,
|
|
arrows: false,
|
|
draggable: true,
|
|
centerMode: true,
|
|
}
|
|
}]
|
|
});
|
|
console.log('slick actu');
|
|
});
|
|
// html.js body.node-type-site.node-id-58 div.dialog-off-canvas-main-canvas div.layout-container.page-node-site main div.layout-content.home-page-layout-content div.region.region-content div#block-reha-contenudelapageprincipale.block.block-system.block-system-main-block article.node-type-site div.entete_site div.image-site div.field.field--name-field-image.field--type-image.field--label-visually_hidden div.field__items
|
|
$(document).ready(function(){
|
|
$('.page-node-site .field--name-field-image .field__items').slick({
|
|
slidesToShow: 1,
|
|
// slidesToScroll: 1,
|
|
dots: true,
|
|
arrows: false,
|
|
// adaptiveHeight: true,
|
|
centerMode: true,
|
|
// centerPadding: '100px',
|
|
responsive: [
|
|
{
|
|
breakpoint: 810,
|
|
settings: {
|
|
slidesToShow: 1,
|
|
adaptiveHeight: true,
|
|
arrows: false,
|
|
draggable: true,
|
|
centerMode: true,
|
|
}
|
|
}]
|
|
});
|
|
console.log('slick site');
|
|
});
|
|
|
|
|
|
|
|
|
|
// /////////////////
|
|
//// ancre dans texte au click parragraphe correspondant arrive en dessous du header
|
|
|
|
function adjustAnchor() {
|
|
var $anchor = $(window.location.hash); // Select the anchor element based on the hash in the URL
|
|
var fixedElementHeight = $('.block-region-first').outerHeight(); // Get the height of the sticky element
|
|
|
|
if ($anchor.length > 0) {
|
|
$('html, body').stop().animate({
|
|
scrollTop: $anchor.offset().top - fixedElementHeight // Adjust the scroll position to account for the sticky element height
|
|
}, 0);
|
|
}
|
|
}
|
|
|
|
// Call the function on page load if there's a hash
|
|
if (window.location.hash) {
|
|
adjustAnchor();
|
|
}
|
|
|
|
// Adjust the anchor on hash change
|
|
$(window).on('hashchange', function() {
|
|
adjustAnchor();
|
|
});
|
|
|
|
|
|
|
|
//////////////////////////////////////////
|
|
// menu ancre paragraphe quand actif
|
|
|
|
jQuery(function($) {
|
|
// Function to set the active class based on the current path
|
|
function setActiveLink() {
|
|
var path = window.location.href;
|
|
console.log(path);
|
|
$(".layout__region--first .block-region-first li a").each(function() {
|
|
if (this.href === path) {
|
|
$(this).closest('a').addClass('active');
|
|
}
|
|
});
|
|
}
|
|
|
|
// Initially set the active link based on the current URL
|
|
setActiveLink();
|
|
|
|
// Update the active link on click
|
|
$(".layout__region--first .block-region-first li a").on('click', function() {
|
|
$(".layout__region--first .block-region-first li a").removeClass('active');
|
|
$(this).addClass('active');
|
|
});
|
|
});
|
|
|
|
|
|
})(jQuery, window);
|
|
|