Good morning everyone,
I have a problem with my jQuery Mobile version of my website:
I'm working with 3 language and what I want is when I click on the other language is to go to the same page but in the new language.
- In the footer, there is a flag who allow me to change language.
- When someone click on the spanish flag (for example), she must to accede to the same page she was viewing but in spanish. (#about_es).
- That's working for the first time but when we want to return on an another page, after, the URL conserve the previous anchor without deleting them. (you can see the capture screen).
capture screen:
My code:
$("body").live('pageshow', function(event){
event.preventDefault();
anchor = "";
anchor = window.location.hash;
anchor = '#'+anchor.substring(1,anchor.length-2);
console.log(anchor);
$('a.same_page').each(function(){
var actuel = $(this).attr('href'); // actuel is what I have in my href, I mean the suffixe: es, fr, en
$(this).attr("href", "").attr("href", anchor+actuel);
});
});
I think the problem comes from JQM and the Ajax but I'm not sur.
I would like to find a way to delete the anchor each time I go on an another page.
Thanks you !
PS: Sorry for my bad english.