Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. invert carousel slide direction

invert carousel slide direction

Scheduled Pinned Locked Moved General Discussion
7 Posts 3 Posters 725 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blurred00
    wrote on last edited by
    #1

    Is possible invert the slide direction from left to right?

    1 Reply Last reply
    1
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      no its not possible

      why do u need that?

      B 1 Reply Last reply
      0
      • arminunruhA arminunruh

        no its not possible

        why do u need that?

        B Offline
        B Offline
        Blurred00
        wrote on last edited by Blurred00
        #3

        @arminunruh
        Screenshot 2023-07-18 alle 09.36.20.png

        because i ve two section that are parallel. it show the same layout but different info content.
        The slide go to left and the result isn't good. Would be cool that it slide at the and respect the parallel design

        K 1 Reply Last reply
        0
        • B Blurred00

          @arminunruh
          Screenshot 2023-07-18 alle 09.36.20.png

          because i ve two section that are parallel. it show the same layout but different info content.
          The slide go to left and the result isn't good. Would be cool that it slide at the and respect the parallel design

          K Offline
          K Offline
          kalamakumaran
          wrote on last edited by kalamakumaran
          #4

          @Blurred00 @arminunruh

          Give the carousel you want to invert the class "reverse"

          Add this to your Custom JS

          <script>
          window.laytheme.on("newpageshown", function(){
          // Get the swiper-container element 
          var swiperContainer = document.querySelector('.swiper-container');
          
          // Check if the element exists and has the "reverse" class
          if (swiperContainer && swiperContainer.classList.contains('reverse')) {
            // Add the dir="rtl" attribute
            swiperContainer.setAttribute('dir', 'rtl');
          }
             });
          </script>
          

          and it should work!

          But apparently it seems to be not possible to add classes to carousels. Is it a bug @arminunruh ?

          Because when I remove the if statement out of the code it affects the .swiper-container and it inverts the direction.

          B 1 Reply Last reply
          1
          • K kalamakumaran

            @Blurred00 @arminunruh

            Give the carousel you want to invert the class "reverse"

            Add this to your Custom JS

            <script>
            window.laytheme.on("newpageshown", function(){
            // Get the swiper-container element 
            var swiperContainer = document.querySelector('.swiper-container');
            
            // Check if the element exists and has the "reverse" class
            if (swiperContainer && swiperContainer.classList.contains('reverse')) {
              // Add the dir="rtl" attribute
              swiperContainer.setAttribute('dir', 'rtl');
            }
               });
            </script>
            

            and it should work!

            But apparently it seems to be not possible to add classes to carousels. Is it a bug @arminunruh ?

            Because when I remove the if statement out of the code it affects the .swiper-container and it inverts the direction.

            B Offline
            B Offline
            Blurred00
            wrote on last edited by
            #5

            @kalamakumaran said in invert carousel slide direction:

            @Blurred00 @arminunruh

            Give the carousel you want to invert the class "reverse"

            Add this to your Custom JS

            <script>
            window.laytheme.on("newpageshown", function(){
            // Get the swiper-container element 
            var swiperContainer = document.querySelector('.swiper-container');
            
            // Check if the element exists and has the "reverse" class
            if (swiperContainer && swiperContainer.classList.contains('reverse')) {
              // Add the dir="rtl" attribute
              swiperContainer.setAttribute('dir', 'rtl');
            }
               });
            </script>
            

            and it should work!

            But apparently it seems to be not possible to add classes to carousels. Is it a bug @arminunruh ?

            Because when I remove the if statement out of the code it affects the .swiper-container and it inverts the direction.

            i ve added it to the custom css tab but don't work. Otherwise i think that it apply this rule to all slide, right?

            The problem is that i want apply it only in one slide.

            1 Reply Last reply
            0
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by
              #6

              @kalamakumaran said in invert carousel slide direction:

              <script>
              window.laytheme.on("newpageshown", function(){
              // Get the swiper-container element
              var swiperContainer = document.querySelector('.swiper-container');

              // Check if the element exists and has the "reverse" class
              if (swiperContainer && swiperContainer.classList.contains('reverse')) {
              // Add the dir="rtl" attribute
              swiperContainer.setAttribute('dir', 'rtl');
              }
              });
              </script>

              <script>
              window.laytheme.on("newpageshown", function(){
              // Get the swiper-container element 
              var $reverse = jQuery('.reverse');
              
              if ($reverse.length > 0) {
                // Add the dir="rtl" attribute
                $reverse.find('.swiper-container').attr('dir', 'rtl');
              }
                 });
              </script>
              

              maybe like this?

              this needs to go into custom <head> content or custom html content. not custom css :D

              But apparently it seems to be not possible to add classes to carousels. Is it a bug @arminunruh ?

              i think this line of code doesnt work:
              swiperContainer.classList.contains('reverse')

              because .swiper-container is a child of .reverse

              because the reverse class is added to .col

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Blurred00
                wrote on last edited by
                #7

                Hey i m really sorry for the late late late late reply. but it works!! thank you so much

                1 Reply Last reply
                1
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                I also code custom websites or custom Lay features.
                šŸ’æ Email me here: šŸ’æ
                info@laytheme.com

                Before you post:
                1. When using a WordPress Cache plugin, disable it or clear your cache.
                2. Update Lay Theme and all Lay Theme Addons
                3. Disable all Plugins
                4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                This often solves issues you might run into

                When you post:
                1. Post a link to where the problem is
                2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                Online Users
                Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                laytheme.com
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Search