Event Listener for Laytheme Instance Updating
-
Hi,
is there a way to listen to the update Event (if the app-instance reloads but the browser/page doesn't) from outside the instance? I'm changing all links on the page via jQuery function. And i need to call the function for that if something on the App is changing (for example, if i click on a project).
Is there a way to get this kind of information out of the app?
BR
Mario -
Dear @uncuerilla
what exactly do you want to achieve?
Can you post a link to your website?
We will then have a look and inspect that!
Many wishes!
Marius -
I set a id-attribute for every project-thumbnail on the category page (for example "p05"). Then I update the href of the link of the project thumb with the same string as parameter (?project=p05). Then the project-page is being shown. At the end of this page I've got a Link "Back to overview", the href of this link should be updated with the parameter of the browser's url (=> ?project=p05).
When the site is opening the category page again a jQuery function should be called that is getting the parameter of the url, to know what Project was clicked before and then scroll to that project thumbnail. Actually it's working, but sometimes the site doesn't reload and just changes the url and the view of the app. That's why the function that puts parameters on the links isn't called. So I need a trigger for that function. Maybe something like "if the new app-route is fully loaded then call the jquery function XY".
I hope I described it so, that you can understand my problem ;-)
Here you can see the test-version of the website:
http://kunden.ruftop-agentur.de/christophspranger/Thanks in advance!!
-
Dear @uncuerilla
did you disable the right click?
Very difficult to debug if you cannot right click…
Best!
Marius -
@mariusjopen oh yeah, sorry! It's disabled now.
-
@mariusjopen I think the problem is, that the jQuery Code runs before the Instance of Lay Theme is fully loaded. So, I just would need a event like "hey Laytheme is now fully loaded!", that my custom code can wait for. You know what I mean? Is there a event, function or something I get access from outside?
-
Try
window.laytheme.on("content_ready", function(){ });
So I guess
window.laytheme.on("newpageshown", function(){ });
is triggered before the content is rlly there right?
mmmh from looking at my code the content should be there when the event newpageshown is triggered
Can you try:
window.laytheme.on("newpageshown", function(){ setTimeout(function(){ //put your code here },0) });
-
Hey Armin,
thank you very much and sorry for the delayed answer! Thats what I was looking for!
Br
Mario -
Dear @uncuerilla
Perfect! Glad to hear!
Many wishes!
Marius
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it