New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way with dynamicaly added step #283
Comments
Are you sure, that you first generate your code and then init impress ? And Regards, cereal
|
Hi cereal thanks for your answer. Yes I keep the init at the bottom. I also tried to add future at the class step (<div class="step future" ... ) without success... |
@ridom Keeping init code "at the bottom" may not mean that it is really executed after the dynamic elements are created. If the dynamic elements are correctly created inside the impress element, with step class and attributes and all of that before the init call, it should work properly. There is no difference between dynamic and static elements for impress.js. What matters - it will only work for steps that are in document when init function is called. If that is possible, please provide some example code on-line. It would be much easier to see and debug what is happening. |
Hi bartaz I advise you when it's on-line. |
@ridom I'd suggest, that you add an event handler, which gets triggered when your dynamic codegeneration is finished.The handler should trigger the initialization of impress. Why should you do this? You are manipulating the documents DOM-Tree. Imagine the following:
That means, that Impress doesn't know your steps, because your steps are inserted after impress is initialized... I hope this was kind of helpful. Regards, |
@cereal |
@ridom Regards, |
@cereal Good luck for your exam! |
$.getJSON makes a AJAX call, the callback function gets started after the |
@cereal I tried with Chrome and I saw it doesn't display nothing while it's displayed with FF. Maybe that's the reason you weren't allowed. I probably did wrong but I have tried different combinations since this morning and nothing works. Here, index.html, you can see the init() with the handler but it doesn't work at all. http://www.brazilian-way.com/impress/index.html#/overview
Here, index2.html, I have included the init(); after the closing parenthesis of AJAX call. It display images but the problem is the same, no step on dynamic div. http://www.brazilian-way.com/impress/index2.html#/overview
I have also tried to place it right after the $(#div).append but it doesn't work too... I don't know what to do. Could it come from the URL? |
Try to put it right after the |
@mbrand I tried it too this morning... |
The problem is that the |
Oh yea, totally missed that he was appending it to the wrong element. |
Yes it works! In fact yes I removed the container and I replaced it by impress. (I added the id #container because initially the divs were generated directly inside #impress and not inside #impress div. Because there wasn't id. I don't know why now it's work...). But it wasn't enough and following the @SimonWaldherr's advice I was looking how to call the impress().init(); at the last moment. So as AJAX is call after everything I placed impress().init() in a js file that is called in an AJAX function at the bottom:
So glad! It's not finish but I now can see what I had in mind. Thanks everyone! Have a look here: |
is there a way to append items after impres().init() ? |
@dinodsaurus short answer: no All the positioning in 3D using transforms (based on data attributes in HTML) is done in |
thank you for the quick answer ! |
I solved it with this little function
|
A little bit hacky, but should work. You can add such function somewhere around impress API as
Exposing it as a global on |
it was just for testing purpose :) |
A little late, but thanks everyone!
As from what I can tell from the comments this issue was solved at the time. Also, the links are not available anymore. Closing then 👍 |
Hi everyone!
I discovered impress.js a few months ago. Thank you bartaz for this awesome tool that makes me crazy just thinking about everything is possible to do with!!
Nevertheless, I am in front of a problem: I have created dynamicaly many div reading an image folder and a json file where each div contains one image and data related. With random variables I have generated values to the attributes.
It works, all the images are displayed in the space and the generated code looks exactly the same than the "normal" one.
The issue is that only the div manually implemented in pure HTML are "stepable". I mean I can move just in the 3 steps formally created but not in the dynamic ones.
Would you have an idea about the way I should follow to make it works as well as a "normal" step?
Hope my explaination is well understandable.
Thanks!
The text was updated successfully, but these errors were encountered: