Change DOM before bringPageTop()
-
Hey,
I use the bringPageTop method to load the view-1.html and show it. When I change the DOM in the then part it will be executed after the animation and the html is already shown. So you see how it changes.
I want to change the dom and then do the animation etc. Is there a way to preload the html file?
Thank you
myNavigator.bringPageTop('html/view-1.html', {animation: 'slide', animationOptions: { duration: 0.2 ,delay: 0 } }) .then(function() { $('.div-in-view-1.html').text("2323"); });
-
@Flosef2 If it’s the first time you push
view-1.html
withbringPageTop
then it just performs a normalpushPage
. That means your page is only a template (a string) and doesn’t exist as DOM per se. We are discussing about adding templating functionality to support this in gh#1447However, you have a way to modify the created pages in their
init
event. That event will run before animations. More info here.
-
@Fran-Diox thanks a lot!
For others having this problem you can use something like this:
document.addEventListener("init", function(e) { if (e.target.matches("#ID-OF-YOUR-PAGE-IN-HTML-FILE")) { //DO SOMETHING BEFORE ANIMATION }
-
btw.
why can I not mark the topic as solved?
-
@Flosef2 You need to first click “Ask as Question?” then when you view the thread, you will see a button “Solved” or mark as solved.