Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. $(document).delegate('.links', 'click', function(evt) {
  2. evt.preventDefault();
  3. var origanalUrl = $(this).attr('href');
  4. var hrefRegEx = /^(^/?{[A-Za-z_]*/?)?([A-Za-z_]+)(.php)$/
  5. var hashUrl2 = origanalUrl.replace(hrefRegEx, '$2');
  6. var hashUrl = '#' + hashUrl2;
  7. var urlExt = ' #ajaxTarget';
  8. var newUrl = origanalUrl + urlExt;
  9. if(!$(hashUrl).html() && hashUrl != '#index') {
  10. $(hashUrl).load(newUrl).ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
  11. newMain = $(hashUrl);
  12. newHeight = newMain.outerHeight();
  13. alert(newHeight);
  14. $('#textBox_main').animate({
  15. height: newHeight
  16. }, 500, function() {
  17. newMain.fadeIn(500);
  18. });
  19. oldMain = newMain;
  20. });
  21. } else {
  22. isLoaded = true;
  23. }
  24.  
  25. $(hashUrl).load(newUrl, function(response, status, xhr) {...} );
  26.  
  27. var fired = false;
  28. $(document).delegate('.links', 'click', function(evt) {
  29. evt.preventDefault();
  30. var origanalUrl = $(this).attr('href');
  31. var hrefRegEx = /^(^/?{[A-Za-z_]*/?)?([A-Za-z_]+)(.php)$/
  32. var hashUrl2 = origanalUrl.replace(hrefRegEx, '$2');
  33. var hashUrl = '#' + hashUrl2;
  34. var urlExt = ' #ajaxTarget';
  35. var newUrl = origanalUrl + urlExt;
  36. if(!$(hashUrl).html() && hashUrl != '#index') {
  37. var ajax = $(hashUrl).load(newUrl);
  38.  
  39. if (!fired) {
  40. ajax.ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
  41. newMain = $(hashUrl);
  42. newHeight = newMain.outerHeight();
  43. alert(newHeight);
  44. $('#textBox_main').animate({
  45. height: newHeight
  46. }, 500, function() {
  47. newMain.fadeIn(500);
  48. });
  49. oldMain = newMain;
  50. });
  51. fired = true;
  52. }
  53. } else {
  54. isLoaded = true;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement