Search…

X3 Photo Gallery Support Forums

Search…
 
ckishappy
Topic Author
Posts: 20
Joined: 21 May 2016, 06:07

trigger page refresh when a specific menu item is hit

24 Jul 2020, 06:34

Hi, I moved my website data to my Nginx web server last night. I realized it is some years by now that I touched x3.. bear with me.

I have two languages (DE and EN) for www.polaschin.ch and would like to trigger a page refresh once EN is chosen to ensure that the English menu is refreshed (as typically the menu wouldn't be refreshed and stay in German)..

Please advise with any thoughts or pointers to make this two language setup work again. Br, Chris
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: trigger page refresh when a specific menu item is hit

25 Jul 2020, 00:24

The reason it doesn't refresh when navigating from primary language (DE) to secondary language (EN), is because the X3 menu considers /en to be a relative X3 link, and loads the page via ajax, without refreshing the entire page and menu. It's a bit stupid that this behavior cannot easily be changed, but I have a Javascript fix for you. Go to Settings > Custom > Custom Javascript, and copy-paste the following:
Code
function x3_load_page(){
 setTimeout(function(){
   document.querySelector('[href="https://polaschin.ch/en"]').classList.add('no-ajax');
 }, 500);
}
We just need to add the no-ajax class to the link, to prevent X3 from hi-jacking the navigation.
 
ckishappy
Topic Author
Posts: 20
Joined: 21 May 2016, 06:07

Re: trigger page refresh when a specific menu item is hit

25 Jul 2020, 04:11

ah the famous x3_load_page function! Thanks for the reminder and this works like a charm!!