script.js
4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
jQuery(document).ready(function($) {
if ($(window).width() > 720) {
setTimeout(function() {
var maxHeight = 0;
$('.thumbnail.course').each(function() {
console.log($(this));
maxHeight = Math.max(maxHeight, $(this).height());
});
$('.thumbnail.course').css({height:maxHeight + 'px'});
},100);
}
var mobile = window.matchMedia( "(max-width: 768px)" );
var isMobile = false;
mobile.addListener(checkMobile);
function checkMobile(e) {
if(e.matches) {
isMobile = true;
mobilize();
} else {
demobilize();
}
}
checkMobile(mobile)
function demobilize() {
}
function mobilize(e) {
}
$('.menu-item-has-children').on('click', function() {
$('.menu-item-has-children').removeClass('open-menu');
if(isMobile) {
$(this).toggleClass('open-menu');
}
});
$('#mySidenav').css('top', -$('#mySidenav').height() - 200).addClass('ready');
$('*').on('focus', function(e) {
if(!isMobile) {
if($(this).parents('.menu-item-has-children').length > 0) {
$(this).parents('.menu-item-has-children').addClass('open-menu');
} else {
$('.menu-item-has-children').removeClass('open-menu');
}
}
});
$(".learning-cards .ugb-card__item .ugb-card__content:empty").parent().addClass('empty').removeClass('ugb--shadow-1');
$(".badge_container").not('.cert').click(function () {
var title = $(this).data('title');
// $("#dialog").dialog({modal: true, height: 590, width: 1005 });
var w = window.open("https://thecommonwell.ca/badge-share/?badge="+title, "popupWindow", "width=400, height=400, scrollbars=no");
});
$('.background-img').each(function(index) {
$(this).parents('.background-img-cont').attr("style", 'background-image:url('+$(this).children('img').attr('src')+');')
$(this).children('img').hide();
});
});
function flipCard(event){
var element = event.currentTarget;
var link = event.currentTarget.getElementsByClassName('link');
var ellipsis = event.currentTarget.getElementsByClassName('ellipsis');
var after = event.currentTarget.getElementsByClassName('after');
var translate = 'scale3d(1, 1, 9) rotateY(180deg) translate(0%, 0%)';
if (jQuery(window).width() <= 768) {
translate = 'scale3d(1, 1, 9) rotateY(180deg) translate(0%, 0px)';
}
if (element.className === "badge-flip-card") {
if(element.style.transform == translate) {
element.style.transform = "";
setTimeout(function(){
jQuery(element).find('.card-content.back').delay(1000).css('backface-visibility', 'hidden');
}, 300);
if(element.className === "staff-flip-card"){
setTimeout(function(){
ellipsis[0].style.visibility='visible';
element.style.zIndex = "1";
}, 300);
}
}
else {
jQuery('.staff-flip-card').css('transform', '');
jQuery('.staff-flip-card').css('z-index', '1');
setTimeout(function(){
jQuery(element).find('.card-content.back').css('backface-visibility', 'visible');
jQuery('.linkedin').attr('style', 'display:block;');
jQuery('.ellipsis').attr('style', 'display:block;');
}, 200);
element.style.transform = translate;
element.style.zIndex = "1000";
if(element.className === "staff-flip-card"){
setTimeout(function(){
ellipsis[0].style.visibility='hidden';
}, 200);
}
}
}
};
document.addEventListener( 'wpcf7invalid', function( event ) {
var is_leaf_submit = jQuery(event.target).parents('#wpcf7-f47761-o1');
setTimeout(function() {
if(is_leaf_submit.length > 0) {
var first_err = jQuery('input[aria-invalid="true"]:first');
if(first_err) {
jQuery([document.documentElement, document.body]).animate({
scrollTop: first_err.offset().top - 200
}, 500);
}
}
}, 500);
}, false );
(function( $ ) {
// the sameHeight functions makes all the selected elements of the same height
$.fn.sameHeight = function() {
var selector = this;
var heights = [];
// Save the heights of every element into an array
selector.each(function(){
var height = $(this).height();
heights.push(height);
});
// Get the biggest height
var maxHeight = Math.max.apply(null, heights);
// Show in the console to verify
console.log(heights,maxHeight);
// Set the maxHeight to every selected element
selector.each(function(){
$(this).height(maxHeight);
});
};
}( jQuery ));