Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1461264

    Hello,
    i use a script to add a class to four images in order to start an animation on my site “vernissageduvar.com”;
    I made it with animation and keyframe and it’s working until i arrive under 400 pixels wide with the adaptativ view tool of Firefox.
    My animation starts when i arrive to the title “Nos réalisations” in the middle of the page “vernissageduvar.com”. it happens only one time.

    Is there something special under 400 pixels wide on Enfold?

    #1461408

    Hey pierremartin311,

    Thank you for the inquiry.

    The animation only starts when we scroll down to the “Nos réalisations” section. Is this the intended behavior? There’s nothing notably different in how the site is rendered under 400px.

    Best regards,
    Ismael

    #1461409

    Hello,
    yes, i told you that it start only when you arrive to this place.
    So why when i put résolution at 400px large it works and 399 i can’t see anything?

    #1461411

    So i can’t see my animation on some mobiles… I notice too that under 400px large, i have to put some ” !important” to make things work…

    #1461413

    Hi!

    Thanks for the info.

    We can still see the animation when the screen width is lower than 399px and even smaller than that. However, please note that as of 2024, the smallest smartphone screen resolutions typically found are around 720 x 1440 pixels, so this shouldn’t be an issue for most visitors.

    Cheers!
    Ismael

    #1461415

    So, i just see that if i don’t use the script it works on small screen!
    it seems that on screen under 400px large, the script don’t works…

    here is my script:

    <script>
    function scrollTrigger(selector, options = {}){
        let els = document.querySelectorAll(selector)
        els = Array.from(els)
        els.forEach(el => {
            addObserver(el, options)
        })
    }
    
    function addObserver(el, options){
        if(!('IntersectionObserver' in window)){
            if(options.cb){
                options.cb(el)
            }else{
                entry.target.classList.add('active')
            }
            return
        }
        let observer = new IntersectionObserver((entries, observer) => { //this takes a callback function which receives two arguments: the elemts list and the observer instance
            entries.forEach(entry => {
                if(entry.isIntersecting){
                    if(options.cb){
                        options.cb(el)
                    }else{
                        entry.target.classList.add('active')
                    }
                    observer.unobserve(entry.target)
                }
            })
        }, options)
        observer.observe(el)
    }
    // Example usages:
    scrollTrigger('.intro-text')
    
    scrollTrigger('.scroll-reveal', {
        rootMargin: '-200px',
    })
    
    scrollTrigger('.loader', {
        rootMargin: '-200px',
        cb: function(el){
            el.innerText = 'Loading...'
            setTimeout(() => {
                el.innerText = 'Task Complete!'
            }, 1000)
        }
    })
    </script>
    #1461417

    I have an iphone 8 and it doesn’t work with the script…. i know Iphone 8 is not so recent but..

    #1461419

    Hi,

    Thank you for the update.

    Which browser are you using on iPhone 8? If it’s an outdated browser, it’s possible that it doesn’t support the IntersectionObserver feature, which could be why the script is not working as expected.

    Best regards,
    Ismael

    #1461422

    So, i found my problem. I changed the rootMargin “-200” by “0” in my script and it works now on my Iphone..

    #1461423

    The problem is that i know nothing in java and i took this script somewhere on the net without understanding really how it works…

    #1461425

    Hi,

    Great! Glad to know that you’ve found the issue. Please feel free to open another thread if you have more questions about the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Animation display problem under 400px…’ is closed to new replies.