aos icon indicating copy to clipboard operation
aos copied to clipboard

AOS does not work with fullpage.js

Open ux-leap opened this issue 5 years ago • 9 comments

  • Question

Hi I'm experiencing an issue with AOS & fullpage.js. Both of them are loading with no errors but AOS does not show the content. I'm using:

https://alvarotrigo.com/fullPage/ & initing AOS after render of fullPage:

afterRender: AOS.init()

Is there any way to make this work?

ux-leap avatar Jul 01 '19 11:07 ux-leap

  • Question

Hi I'm experiencing an issue with AOS & fullpage.js. Both of them are loading with no errors but AOS does not show the content. I'm using:

https://alvarotrigo.com/fullPage/ & initing AOS after render of fullPage:

afterRender: AOS.init()

Is there any way to make this work?

I have a similar problem. When full screen scrolling AOS does not work and the animation does not work. Did you find any solution? I tried AOS.refresh() and AOS.refreshHard() and it did not help. I also tried to add a class aos-animate but script still removes it myself.

vaban-ru avatar Jul 10 '19 06:07 vaban-ru

subscribed, running into same issue here. I can only play one animation on the first section and other section have their elements hidden who have any of the AOS animations set.

likewhoa avatar Oct 03 '19 14:10 likewhoa

fullpage({
      afterLoad(_, index) {
        if (index === 1) {
          return
        }

        const $section = $('.section').eq(index - 1)
        $section.find('[data-aos]').addClass('aos-animate')
      },
      ...
    })

A little bit foible, but can work.

think2011 avatar Oct 06 '19 07:10 think2011

afterLoad: function(){
	$('.fp-table.active .aos-init').addClass('aos-animate');
},

kayaz avatar Oct 10 '19 02:10 kayaz

I think I've got a solution - maybe it's not perfect, but works for me. I used last version of AOS, fullpage.js and jQuery.

`

AOS.init();  // AOS initiation

$('.aos-init').removeClass('aos-animate'); // remove ALL classes which triggers animation in document

new fullpage('#fullpage', {   // standard fullpage usage
    responsive: true,
    navigation: true,
    anchors: ['start', 'quality', 'performance', 'dob', 'parameters','compatibility', 'options', 'contact'],

    afterLoad: function(){       
        var a_table = ['start', 'quality', 'performance', 'dob', 'parameters','compatibility', 'options', 'contact'];   // duplicated table of anchors name

        for (var i = 0; i < a_table.length; i++) {
            $('.section-'+ a_table[i] +'.active .aos-init').addClass('aos-animate'); // all magic goes here - when page is active, then all elements with AOS will start animate
        }
    }
});

`

Unfortunetly, animation triggers only once per scroll.

gr0hiik avatar Nov 29 '19 11:11 gr0hiik

This will trigger animations with every scroll:

new fullpage('.fullpage', {
    //.............................................
    //....Your other options....
    //..............................................
    onLeave: function(){
        jQuery('.section [data-aos]').removeClass("aos-animate");
    },
    onSlideLeave: function(){
        jQuery('.slide [data-aos]').removeClass("aos-animate");
    },
    afterSlideLoad: function(){
        jQuery('.slide.active [data-aos]').addClass("aos-animate");
    },
    afterLoad: function(){
        jQuery('.section.active [data-aos]').addClass("aos-animate");
       //jQuery('.fp-table.active .aos-init').addClass('aos-animate');
    }
});

reza-mamun avatar Mar 25 '20 18:03 reza-mamun

afterLoad: function(){
	$('.fp-table.active .aos-init').addClass('aos-animate');
},

Thanks for the answer, in my case, I was not using jquery, so I tweaked it to the traditional javascript way:

afterLoad: function() {
  document.querySelectorAll('.fp-table.active .aos-init').forEach((el) => {
    el.classList.add('aos-animate')
  })
}

hayden-664 avatar Jun 28 '22 06:06 hayden-664

afterLoad: function(){ $('.fp-table.active .aos-init').addClass('aos-animate'); },

Thank you, this works for me, but I have initial problem on first screen of fullpage. all works from second screen. Do someone have same problem?

pettrushkov avatar Feb 08 '23 18:02 pettrushkov

add option:

afterLoad: function(before, after){
    after.item.querySelectorAll('.aos-init').forEach((el) => {
      el.classList.add('aos-animate')
    })
  },
  beforeLeave: function(before, after) {
    before.item.querySelectorAll('.aos-init').forEach((el) => {
      el.classList.remove('aos-animate')
    })
  }

breath-co2 avatar Mar 21 '24 07:03 breath-co2