• PG

    $(document).ready(function() { // animation var anim = $('.animation'); if (anim != null){ if (isInViewport(anim[0])) { anim[0].classList.add("in-viewport"); } window.addEventListener('scroll', function (event) { for (var i = 0; i < anim.length; i++) { if (isInViewport(anim[i])) { anim[i].classList.add("in-viewport"); } } }, false); } $(".twentytwenty-container").twentytwenty({ default_offset_pct: 0.5, // How much of the before image is visible when the page loads orientation: 'horizontal', // Orientation of the before and after images ('horizontal' or 'vertical') before_label: '', // Set a custom before label after_label: '', // Set a custom after label no_overlay: true, //Do not show the overlay with before and after move_slider_on_hover: false, // Move slider on mouse hover? move_with_handle_only: true, // Allow a user to swipe anywhere on the image to control slider movement. click_to_move: false // Allow a user to click (or tap) anywhere on the image to move the slider to that locations. }); setInterval(function() { var e = $("#compare-one .twentytwenty-handle").offset().left , t = $("body").prop("scrollWidth") / 2 , n = $("#compare-one .twentytwenty-before").width() / 8 , i = 0; $("body").prop("scrollWidth") < 721 && (i = 20), e + i > t + n ? ($("#compare-one .textRight1").addClass("disappear"), $("#compare-one .textRight2").addClass("disappear"), $("#compare-one .textLeft1").removeClass("disappear"), $("#compare-one .textLeft2").removeClass("disappear")) : e + i < t - n ? ($("#compare-one .textLeft1").addClass("disappear"), $("#compare-one .textLeft2").addClass("disappear"), $("#compare-one .textRight1").removeClass("disappear"), $("#compare-one .textRight2").removeClass("disappear")) : ($("#compare-one .textLeft1").removeClass("disappear"), $("#compare-one .textLeft2").removeClass("disappear"), $("#compare-one .textRight1").removeClass("disappear"), $("#compare-one .textRight2").removeClass("disappear")) }, 300) });
    PG