Page 1 of 1

Javascript after render

Posted: Thu Jul 13, 2017 4:37 pm
by ekidhardt
I'm kind of new at this - so if I'm missing something obvious, please be patient. Here's what I'm trying to do:

I have a subfile that is detected in Genie - all divs get assigned class 'cell'. I've taken the 'cell' class and changed the display type to 'flex' to allow for more control over the placement of the contained div. Currently, the 'justify-content' setting is 'flex-end' for all cells.

I want to be able to vary the 'justify-content' so I can control the alignment of columns based on the 'left' value of the parent div.

I've tried to write a script, but it always runs before the screen is rendered - my getElementsByClassName() array is always empty. Where can I place my function call so that it fires after the screen is rendered?

Sorry if this is a noob question, I've only been programming RPG for a few months and this is my first project with Profound and Genie.

Re: Javascript after render

Posted: Thu Jul 13, 2017 4:50 pm
by Scott Klement
Hiya Ed,

I'd suggest taking a look at the "JavaScript Coding" section of the documentation if you haven't already. For this specific question, the "Global Events" page would be very helpful.
http://www.profoundlogic.com/docs/displ ... bal+Events

In particular, it's important to note that there are different events in Genie that run at different times. Most of the time, you want to use the "customize" event for changes to the display... but sometimes there are advantages to the other events that run at different times. The above link lists them all.

Re: Javascript after render

Posted: Thu Jul 13, 2017 5:12 pm
by ekidhardt
Exactly what I was looking for - worked like a charm!

Thanks for the help, Scott.