You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

56 lines
1.5 KiB

(function (Drupal) {
//stuff goes here
})(Drupal);
(function (Drupal) {
Drupal.behaviors.LangSwitchBehavior = {
attach: function (context, settings) {
const textEn = context.querySelector('#text-en');
const textFr = context.querySelector('#text-fr');
const showEn = context.querySelector('#show-text-en');
const showFr = context.querySelector('#show-text-fr');
// Hide French text initially
if (textFr) {
textFr.style.display = 'none';
}
if (showEn && textEn && textFr) {
showEn.addEventListener('click', function (e) {
e.preventDefault();
textEn.style.display = '';
textFr.style.display = 'none';
});
}
if (showFr && textEn && textFr) {
showFr.addEventListener('click', function (e) {
e.preventDefault();
textEn.style.display = 'none';
textFr.style.display = '';
});
}
}
};
})(Drupal);
//(function ($) {
//Drupal.behaviors.LangSwitchBehavior = {
//attach: function (context, settings) {
//$("#text-fr").hide();
//$( "#show-text-en" , context).click(function(e) {
//e.preventDefault();
//$("#text-en").show();
//$("#text-fr").hide();
//});
//$( "#show-text-fr" , context).click(function(e) {
//e.preventDefault();
//$("#text-en").hide();
//$("#text-fr").show();
//});
//}
//};
//}(jQuery));