PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.2
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.2
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / public / assets / js / scripts.js

scripts.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.4.2, at public/assets/js/scripts.js

152 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2 if ($('.sp-pcp-container').length > 0) {
3 $('.sp-pcp-container').each(function () {
4
5 var pcp_container = $(this),
6 pcp_container_id = pcp_container.attr('id'),
7 PCP_Wrapper_ID = '#' + pcp_container_id,
8 // pc_sid = $(PCP_Wrapper_ID).data('sid'), // The Shortcode ID.
9 pcpCarousel = $('#' + pcp_container_id + ' .sp-pcp-carousel'),
10 /* pcpfilter = $('#' + pcp_container_id + '.pcp-filter-wrapper'),
11 ajaxurl = sppcp.ajaxurl,
12 nonce = sppcp.nonce, */
13 pcpCarouselData = pcpCarousel.data('carousel');
14 if (pcpCarousel.length > 0) {
15 // Carousel Swiper for Standard mode.
16 var pcpSwiper = new Swiper('#' + pcp_container_id + ' .sp-pcp-carousel', {
17 speed: pcpCarouselData.speed,
18 slidesPerView: pcpCarouselData.slidesPerView.mobile,
19 spaceBetween: pcpCarouselData.spaceBetween,
20 loop: pcpCarouselData.loop,
21 loopFillGroupWithBlank: true,
22 autoHeight: pcpCarouselData.autoHeight,
23 simulateTouch: pcpCarouselData.simulateTouch,
24 allowTouchMove: pcpCarouselData.allowTouchMove,
25 centeredSlides: pcpCarouselData.center_mode,
26 mousewheel: pcpCarouselData.slider_mouse_wheel,
27 lazy: pcpCarouselData.lazy,
28 //grabCursor: true,
29 pagination:
30 pcpCarouselData.pagination == true
31 ? {
32 el: '.swiper-pagination',
33 clickable: true,
34 dynamicBullets: pcpCarouselData.dynamicBullets,
35 renderBullet: function (index, className) {
36 if (pcpCarouselData.bullet_types == 'number') {
37 return (
38 '<span class="' +
39 className +
40 '">' +
41 (index + 1) +
42 '</span>'
43 )
44 } else {
45 return '<span class="' + className + '"></span>'
46 }
47 }
48 }
49 : false,
50 autoplay: {
51 delay: pcpCarouselData.autoplay_speed
52 },
53 navigation:
54 pcpCarouselData.navigation == true
55 ? {
56 nextEl: '.pcp-button-next',
57 prevEl: '.pcp-button-prev'
58 }
59 : false,
60 breakpoints: {
61 576: {
62 slidesPerView: pcpCarouselData.slidesPerView.mobile_landscape,
63 navigation:
64 pcpCarouselData.navigation_mobile == true
65 ? {
66 nextEl: '.pcp-button-next',
67 prevEl: '.pcp-button-prev'
68 }
69 : false,
70 pagination:
71 pcpCarouselData.pagination_mobile == true
72 ? {
73 el: '.swiper-pagination',
74 clickable: true,
75 dynamicBullets: pcpCarouselData.dynamicBullets,
76 renderBullet: function (index, className) {
77 if (pcpCarouselData.bullet_types == 'number') {
78 return (
79 '<span class="' +
80 className +
81 '">' +
82 (index + 1) +
83 '</span>'
84 )
85 } else {
86 return '<span class="' + className + '"></span>'
87 }
88 }
89 }
90 : false
91 },
92 768: {
93 slidesPerView: pcpCarouselData.slidesPerView.tablet,
94 },
95 992: {
96 slidesPerView: pcpCarouselData.slidesPerView.desktop,
97 },
98 1200: {
99 slidesPerView: pcpCarouselData.slidesPerView.lg_desktop,
100 },
101 },
102 fadeEffect: {
103 crossFade: true
104 },
105 ally: {
106 enabled: pcpCarouselData.enabled,
107 prevSlideMessage: pcpCarouselData.prevSlideMessage,
108 nextSlideMessage: pcpCarouselData.nextSlideMessage,
109 firstSlideMessage: pcpCarouselData.firstSlideMessage,
110 lastSlideMessage: pcpCarouselData.lastSlideMessage,
111 paginationBulletMessage: pcpCarouselData.paginationBulletMessage
112 },
113 keyboard: {
114 enabled: true
115 }
116 })
117 if (pcpCarouselData.autoplay === false) {
118 pcpSwiper.autoplay.stop()
119 }
120 if (pcpCarouselData.stop_onHover && pcpCarouselData.autoplay) {
121 $(pcpCarousel).hover(
122 function () {
123 pcpSwiper.autoplay.stop()
124 },
125 function () {
126 pcpSwiper.autoplay.start()
127 }
128 )
129 }
130 $(window).resize(function () {
131 pcpSwiper.update()
132 })
133 $(window).trigger("resize")
134 }
135
136 /**
137 * Grid masonry.
138 */
139 if ($(PCP_Wrapper_ID).hasClass('pcp-masonry')) {
140 var $post_wrapper = $('.sp-pcp-row', PCP_Wrapper_ID)
141 $post_wrapper.imagesLoaded(function () {
142 $post_wrapper.masonry()
143 })
144 }
145 /* Preloader js */
146 $(document).ready(function() {
147 $(".pcp-preloader", PCP_Wrapper_ID).css({ "backgroundImage": "none", "visibility": "hidden" });
148 });
149 })
150 }
151 })
152