Question

setInterval(function(){
  if(current_url == ''){
    window.location.hash = '#!/home';
    current_url = window.location.hash.href;
  }
  else if(current_url !== window.location){
    change_page(window.location.hash.split('#!/')[1]);
    current_url = window.location.hash.href;
  }
},100)

Cette partie de mon JavaScript / JQuery fait Firefox sur Mac ne ressemble à ça rechargeant en permanence. Sur Firefox sur W7 il ne fonctionne pas et Chrome sur les deux systèmes d'exploitation, il fonctionne très bien aussi. Comment puis-je faire cesser ressembler à son chargement dans la barre impressionnante sur Firefox?

Pour votre information, im faisant ainsi en arrière / avant la fonctionnalité du bouton fonctionne ...

Était-ce utile?

La solution

Essayez ceci:

var hashChanged = function() {
  if(current_url == '') {
    window.location.hash = '#!/home';
    current_url = window.location.hash;
  }
  else if(current_url !== window.location.hash){
    change_page(window.location.hash.split('#!/')[1]);
    current_url = window.location.hash;
  }
};

if('onhashchange' in window) {
    window.onhashchange = hashChanged;
} else {
    setInterval(hashChanged, 100);
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top