Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. //pre carregando o gif
  2. $('a').live('click', function( e ){
  3. e.preventDefault();
  4. content.html( '<div class="loader"></div>' );
  5.  
  6. var href = $( this ).attr('href');
  7. $.ajax({
  8. url: href,
  9. success: function( response ){
  10. //forçando o parser
  11. var data = $( '<div>'+response+'</div>' ).find('#content').html();
  12.  
  13. //apenas atrasando a troca, para mostrarmos o loading
  14. window.setTimeout( function(){
  15. content.fadeOut('slow', function(){
  16. content.html( data ).fadeIn();
  17. });
  18. }, 500 );
  19. }
  20. });
  21.  
  22. });
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement