script.js
3.9 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
(function($){
/**
* initializeBlock
*
* Adds custom JavaScript to the block HTML.
*
* @date 15/4/19
* @since 1.0.0
*
* @param object $block The block jQuery element.
* @param object attributes The block attributes (only available when editing).
* @return void
*/
var initializeBlock = function( $block ) {
// $block.find('.carousel-items:not(.large)').slick({
// dots: false,
// infinite: true,
// speed: 300,
// slidesToShow: 4,
// adaptiveHeight: false,
// arrows:true,
// variableWidth: true,
// responsive: [
// {
// breakpoint: 1024,
// settings: {
// slidesToShow: 3,
// slidesToScroll: 1,
// }
// },
// {
// breakpoint: 600,
// settings: {
// slidesToShow: 2,
// slidesToScroll: 1
// }
// },
// {
// breakpoint: 480,
// settings: {
// slidesToShow: 1,
// slidesToScroll: 1
// }
// }
// // You can unslick at a given breakpoint now by adding:
// // settings: "unslick"
// // instead of a settings object
// ]
// });
// $block.find('.carousel-items.large').slick({
// dots: false,
// centerMode:true,
// infinite: true,
// speed: 300,
// slidesToShow: 2,
// adaptiveHeight: false,
// arrows:true,
// variableWidth: true,
// responsive: [
// {
// breakpoint: 1024,
// settings: {
// slidesToShow: 2,
// slidesToScroll: 1,
// }
// },
// {
// breakpoint: 600,
// settings: {
// slidesToShow: 2,
// slidesToScroll: 1
// }
// },
// {
// breakpoint: 480,
// settings: {
// slidesToShow: 1,
// slidesToScroll: 1
// }
// }
// // You can unslick at a given breakpoint now by adding:
// // settings: "unslick"
// // instead of a settings object
// ]
// });
// $('.slick-list').css('margin-left', $('.entry-content').css('margin-left'));
$($block).css('margin-left',"-"+$('.entry-content').css('margin-left'));
}
// Initialize each block on page load (front end).
// $(document).ready(function(){
// $('.carousel').each(function(){
// initializeBlock( $(this) );
// });
// });
// Initialize dynamic block preview (editor).
if( window.acf ) {
window.acf.addAction( 'render_block_preview/type=quote', initializeBlock );
}
})(jQuery);
// (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 ));