custom-javascript.js
2.14 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
// Add your custom JS here.
jQuery( document ).ready(function($) {
$('.wp-block-button__link').attr('tabindex', 0);
$(document).on("click","#register-here",function() {
$('.wp-block-group.register').toggle();
$('.numbers-second .wp-block-column:first-child a.wp-block-button__link').toggleClass('rotated');
$([document.documentElement, document.body]).animate({
scrollTop: $(".wp-block-group.register").offset().top
}, 500);
});
$( "#register-here" ).on( "keydown", function(event) {
if(event.which == 13){
$('.wp-block-group.register').toggle();
$('.numbers-second .wp-block-column:first-child a.wp-block-button__link').toggleClass('rotated');
$([document.documentElement, document.body]).animate({
scrollTop: $(".wp-block-group.register").offset().top
}, 500);
}
});
$('.wpcf7-form-control-wrap').each(function( index ) {
$(this).parent().addClass($(this).attr('class').split(' ')[1]);
});
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '36' == event.detail.contactFormId ) {
console.log('wpcf7submit');
$('.fieldset-cf7mls-wrapper').remove();
$('.cf7mls_progress_bar').remove();
$('.thank-you').show();
}
}, false );
var boxes = document.querySelectorAll("g");
var box = getShuffledArr(boxes);
function getShuffledArr (arr){
return [...arr].map( (_, i, arrCopy) => {
var rand = i + ( Math.floor( Math.random() * (arrCopy.length - i) ) );
[arrCopy[rand], arrCopy[i]] = [arrCopy[i], arrCopy[rand]]
return arrCopy[i]
})
}
box.forEach((element,i) => {
setTimeout(
function(){
animateMe(element)
}
, i * 750);
});
function animateMe(box){
let tl = gsap.timeline();
tl.to(box, 1.5, {opacity:0.6})
.to(box, 1.5,{opacity:0.07})
}
function randomNumber(min, max) {
return Math.random() * (max - min) + min;
}
});