Created
April 6, 2026 17:44
-
-
Save junaidpv/427dd35f6285eba946fd7c1da1d4b76f to your computer and use it in GitHub Desktop.
Patch for views_slideshow moule to make Responsive Layout Builder module to integrate with views slideshows. Updated version of https://gist.github.com/junaidpv/ea18d7e61eca50ea1b24b39560b48b8c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/modules/views_slideshow_cycle/js/rpp-slideshows.js b/modules/views_slideshow_cycle/js/rpp-slideshows.js | |
| new file mode 100644 | |
| index 0000000..06377ca | |
| --- /dev/null | |
| +++ b/modules/views_slideshow_cycle/js/rpp-slideshows.js | |
| @@ -0,0 +1,21 @@ | |
| +(function ($) { | |
| + // Update the window dimensions on each resize. | |
| + $(window).on("resize", function () { | |
| + Drupal.behaviors.views_slideshow_test.onResize(); | |
| + }); | |
| + | |
| + Drupal.behaviors.views_slideshow_test = { | |
| + | |
| + attach: function (context) { | |
| + this.onResize(); | |
| + }, | |
| + | |
| + onResize: function () { | |
| + once('rlb-views-slideshow', $('.rlb-load-hidden').filter(':visible')).forEach(function(){ | |
| + Drupal.behaviors.viewsSlideshowCycle.attach(this); | |
| + }); | |
| + } | |
| + | |
| + }; | |
| + | |
| +})(jQuery); | |
| diff --git a/modules/views_slideshow_cycle/js/views_slideshow_cycle.js b/modules/views_slideshow_cycle/js/views_slideshow_cycle.js | |
| index 57d13be..fc00d67 100644 | |
| --- a/modules/views_slideshow_cycle/js/views_slideshow_cycle.js | |
| +++ b/modules/views_slideshow_cycle/js/views_slideshow_cycle.js | |
| @@ -10,6 +10,10 @@ | |
| Drupal.behaviors.viewsSlideshowCycle = { | |
| attach: function (context) { | |
| $('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).addClass('viewsSlideshowCycle-processed').each(function () { | |
| + if ($(this).is(":hidden") && $(this).parents('.rlb-load-hidden').length) { | |
| + $(this).removeClass('viewsSlideshowCycle-processed'); | |
| + return; | |
| + } | |
| var fullId = '#' + $(this).attr('id'); | |
| var settings = drupalSettings.viewsSlideshowCycle[fullId]; | |
| settings.targetId = '#' + $(fullId + " :first").attr('id'); | |
| diff --git a/modules/views_slideshow_cycle/views_slideshow_cycle.libraries.yml b/modules/views_slideshow_cycle/views_slideshow_cycle.libraries.yml | |
| index b475acb..0f7a66c 100644 | |
| --- a/modules/views_slideshow_cycle/views_slideshow_cycle.libraries.yml | |
| +++ b/modules/views_slideshow_cycle/views_slideshow_cycle.libraries.yml | |
| @@ -11,10 +11,12 @@ views_slideshow_cycle: | |
| css/views_slideshow_cycle.css: {} | |
| js: | |
| js/views_slideshow_cycle.js: {} | |
| + js/rpp-slideshows.js: {} | |
| dependencies: | |
| - core/jquery | |
| - core/drupal | |
| - core/drupalSettings | |
| + - core/once | |
| jquery_cycle: | |
| remote: http://malsup.github.io/jquery.cycle.all.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment