Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Esse é a porra do HTML, esse addthis:url era para ser a url q vai ser compartilhada
  2.  
  3. <a id="contato-share" class="social addthis_button" addthis:url="" addthis:title="Ellen Oleria - Contato">Compartilhe</a>
  4.  
  5. // Só que ele tb pode ser passado pela variável addthis_share.url , mas qdo eu passo, não está surtindo efeito
  6. // o código que atualiza o hash é o seguinte...
  7.  
  8. hash = window.location.hash;
  9.  
  10. if( hash !== ''){
  11.   $('#contato-tabs a[href=' + hash + ']').tab('show');
  12. }
  13.  
  14. $(window).on('hashchange', function(){
  15.   if (!window.location.origin){
  16.     window.location.origin = window.location.protocol+"//"+window.location.host;
  17.   }
  18.   base_url = window.location.origin + window.location.pathname;
  19.   new_hash = window.location.hash;
  20.   $('#contato-tabs a[href=' + new_hash + ']').tab('show');
  21.  
  22.  
  23. //Essa porra não surte efeito, será q precisa fazer algum binding diferente?
  24.   if(!typeof addthis_share === 'undefined'){
  25.     addthis_share.url = base_url + new_hash;
  26.   }
  27. });
  28.  
  29. $('a[data-toggle="tab"]').on('show.bs.tab', function(e){
  30.   window.location.hash = $(e.target).attr('href');
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement