Tagged: avia, javascript, runtime
Hi,
I want to add Avia-Elements on runtime, especially new Color Section with parallax. I can add those elements without a problem with something like this:
const section = document.createElement('div');
section.id = 'av_section_wp' + i;
section.classList.add('avia-section', 'alternate_color', 'avia-section-default', 'avia-no-border-styling', 'avia-full-stretch', 'av-parallax-section', 'avia-bg-style-parallax', 'av-minimum-height', 'av-minimum-height-100', 'av-height-100', 'container_wrap', 'fullscreen');
section.dataset.sectionBgRepeat = 'stretch';
section.dataset.av_minimum_height_pc = '100';
section.dataset.av_min_height_opt = '100';
const sectionParallax = document.createElement('div');
sectionParallax.classList.add('av-parallax', 'active-parallax', 'enabled-parallax');
sectionParallax.dataset.aviaParallaxRation = '0.3';
...
But this new section doesn’t have a parallax effect. It seems like it is isn’t registered in the JavaScript module for parallax. Is there a way to register those elements or generally speaking, is there a better way to add Avia elements on runtime?
Best,
Henning