Jump to content
Search Community

PSMJonas

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by PSMJonas

  1. I have the problem that only on mobile devices the start of my Scrollmagic animation is not calculated correctly. On desktop devices the calculation works without problems. It doesn't matter which browser I use.

     

    URL: https://pechschwarzmedia.de/webdesign-agentur/

     

    $('.animation-image_video').each(function() {
            var element = $(this);
            ScrollTrigger.ScrollTrigger.create({
                trigger: element,
                pin: element.find(".animation-image_video__media"),
                start: "top top",
                end: "bottom bottom",
                markers: true
            }
    );

    });

     

     

     

    correct.jpg

    incorrect.jpg

  2. Thank you very much for your answer. The problem is that the overlay is dynamic. I have updated the CodePen link again:

     

    See the Pen vYpNyBp by jonasloerken (@jonasloerken) on CodePen

     

    This leads to the fact that I can not create the timeline outside of a function, right? Otherwise I can't open or close the right overlay with the play() and reversed() functions.

  3. I use GSAP (Timeline) to show and hide an overlay. The overlay can be opened and closed without any problems. But when I want to open it again, it does not work.

     

    function animate_media(overlay, reversed) {
        var media_tl = gsap.timeline({repeat: 0, paused: true});
        media_tl.from(overlay, {duration: 0.5, y: 30, autoAlpha: 0});
    
        if(reversed) {
            media_tl.reverse(0);
        } else {
            media_tl.play();
        }
    }

    I pass the element and a boolean value to the function (depending on whether the overlay should open or close).

     

    I noticed that the overlay keeps the following inline code after closing: opacity: 0; visibility: hidden; transform: translate(0px, 30px);

     

    Is there a possibility to show the overlay again after closing, i.e. to play the animation again?

    • Like 1
×
×
  • Create New...