1

I'm using Scrollreveal.js to reveal some divs on my website.

Now i want Scrollreveal to call a function after it has revealed a specific div.

As the documentation says:

" // Callbacks that fire for each completed element reveal, and reset.

afterReveal: function (domEl) {},

afterReset: function (domEl) {}"

My code:

var demo = new CountUp('mails', 0, 641, 0, 2.5, options);

sr.reveal('#mails', {
duration   : 600,
delay      : 200,
distance   : '220px',
easing     : 'ease-out',
origin     : 'left',
scale      : 1,
viewFactor : 0.2,
afterReveal: function (domEl) {domEl.demo();}});

Can anyone tell me what the correct syntax is to call my variable after the div has been revealed?

I have tried for a long time to do it myself, with no positive results, so i think it's ok to ask someone for help now :)

Thanks!

Vegapunk
  • 99
  • 7

1 Answers1

1

Figured it out, it wasn't difficult, as i suspected, just me being new to this :)

so to shorten this, this is how i used CountUp.js with Scrollreveal.js

sr.reveal('#mails', {
duration   : 600,
delay      : 200,
distance   : '220px',
easing     : 'ease-out',
origin     : 'left',
scale      : 1,
viewFactor : 0.2,
beforeReveal: function(){var options = {
useEasing: true, useGrouping: true, separator: ',', decimal: '.', 
};
var demo = new CountUp('mails', 0, 641, 0, 2.5, options);
if (!demo.error) {demo.start();
} else {console.error(demo.error);
}},
});
Vegapunk
  • 99
  • 7