before/after element - position of separation

Hello,

we use the before/after element. By default the image is split down the middle. Is there a way to have the slider start at a different location?

Why we want this: In the first picture we show text that contains errors. In the second picture we show the text without errors. It would make sense if the image splitter or slider started on the far right, so that when you first look at the element, it is mainly the first image with the errors in the text that is visible. Only when you move the slider to the left will the corrected text become visible.

Interestingly, onthe BeTheme website (https://muffingroup.com/betheme/elements/before-after/) the slider is not in the middle, but it is in the theme itself. And I haven't found a way to change the start position of the slider.

It would be great if there was a solution for this. I can do most of the customization with CSS, but here it seems like the position calculation is done inline, so I haven't found a way. Is there a CSS way to change the start position of the slider?

Thank you for your feedback!


Comments

  • Hi,

    For the example on our website, we use the following script to move it:

    $(window).on('load', function(){
        $(".twentytwenty-container").twentytwenty({default_offset_pct: 0.624, before_label: 'Backend', after_label: 'Frontpage'});
    });
    

    You can use it and put it in Betheme -> Theme options -> Custom CSS & JS -> JS.

    Please note two things:

    1) It will affect all Before/After elements on your website.

    2) It is JS. This means that the script must load, and initially, the split line is in the middle, and it will move right after this script loads.


    Best regards

  • Hello,

    thank you very much for the quick response.

    I copied the code and pasted it into the JS field. Unfortunately it doesn't work.

    I also cleared the cache and disabled the performance plugin. However, the split line remains in the middle and does not change position.

    What am I doing wrong?

    Best regards

  • Sorry, my bad.

    The correct code should look actually like this:

    jQuery(window).on('load', function(){
       setTimeout(function(){
           jQuery(".twentytwenty-container").twentytwenty({default_offset_pct: 0.7, before_label: 'Backend', after_label: 'Frontpage'});
       },500);   
    });
    

    Best regards

  • Hi,

    it worked, thank you for the quick and uncomplicated help!

    Best regards

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.