drupal-quartiersdedemain/web/themes/custom/quartiers_de_demain/js/quartiers_de_demain.js

68 lines
1.3 KiB
JavaScript

/**
* @file
* quartiers_de_demain behaviors.
*/
(function (Drupal) {
'use strict';
Drupal.behaviors.quartiers_de_demain = {
attach: function (context, settings) {
console.log('It works!');
}
};
} (Drupal));
jQuery(document).ready(function($){
$('.open-block').click(function(){
$(this).toggleClass('opened');
$('.header_nav_container').toggleClass('display-nav-opened');
if(mobile == true){
$("body").css("overflow","hidden");
}
});
// Hide the header_nav_container when a link inside it is clicked
$('.header_nav_container li').click(function() {
$('.header_nav_container').fadeOut();
});
//////////// agrandissement du shema
$('#paragraph-id--9 img').click(function() {
$(this).toggleClass('zoom_in');
});
});
// /////////////////
//// ancre dans texte au click parragraphe correspondant arrive en dessous du header
(function($, window) {
var adjustAnchor = function() {
var $anchor = $('.sidebar_first_container'),
fixedElementHeight = 350;
if ($anchor.length > 0) {
$('html, body').stop().animate({scrollTop: $anchor.offset().top - fixedElementHeight }, 0);
}
};
$(window).on('hashchange', function() {
adjustAnchor();
});
})(jQuery, window);