custom-javascript.js
2.42 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
// Add your custom JS here.
import jquery from 'jquery';
import LazyLoad from "vanilla-lazyload";
import DataTable from 'datatables.net-dt';
import "./_menu_mobile";
import "./_search";
import "./_header_menu";
import "./_side_menu";
import "./_image_captionation";
import "./_carousels";
var myLazyLoad = new LazyLoad();
window.tz_checkVisible = function(elm, evalType , offset, heightBuffer) {
evalType = evalType || "visible";
var vpH = jQuery(window).height(), // Viewport Height
st = jQuery(window).scrollTop(), // Scroll Top
y = jQuery(elm).offset().top + offset,
elementHeight = jQuery(elm).height();
if (heightBuffer) {
elementHeight += heightBuffer;
}
if (evalType === "visible") return ((y < (vpH + st)) && (y > (st - elementHeight)));
if (evalType === "above") return ((y < (vpH + st)));
};
jQuery(document).ready(function($) {
$('#relevant-resources').dataTable( {
info: false,
ordering: false,
paging: true,
bLengthChange: false,
bFilter: false,
pagingType: "numbers",
pageLength: 10
} );
$('#relevant-resources').on( 'page.dt', function () {
$('html, body, #page').animate({
scrollTop: $("#relevant-resources").offset().top - 250
}, 100);
});
(function() {
var origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url) {
this.addEventListener('load', function() {
if(url.includes('search')){
setTimeout(function(){
$('html, body, #page').animate({
scrollTop: $("#search-wrapper").offset().top - 250
}, 100);
console.log('click');
}, 100);
}
});
this.addEventListener('error', function() {
});
origOpen.apply(this, arguments);
};
})();
});
document.addEventListener( 'wpcf7mailsent', function( event ) {
jQuery('.appArea.responsive').hide();
}, true );
// jQuery(document).ready(function($) {
// $(document).on("click", ".pojo-a11y-toolbar-link", function(e){
// console.log('click');
// $('.gt_options').hasClass('gt-open') ? $('.gt_options').removeClass('gt-open') : $('.gt_options').addClass('gt-open');
// });
// });