I want to insert a div after a passage:
The JS is in the Story JS and the CSS in the Story Stylesheet.
#case_1_image is not showing and also not in the page source.
What am I doing wrong?
BTW the div
#passage-cs1-p1shows the background image fine.
Why not just add
<div id='case_1_image'></div> in the passage directly? Like at the bottom of the coded passage?
Whatever code + text you have in the passage
Ah, new to Twine, but that makes sense!
The reason your code didn’t work, is because there is no
#passage-cs1-p1 unless that’s the very first passage of your game, because passages don’t exist as elements in that way unless they are the current passage.
<<script>> macro, or (better practice) use an event listener to listen for the passage load events and do something there.
There is a “PassageFooter” you can add (a specially named passage) that will get added to the bottom of every page. You might want to do it that way.