Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).delegate('.links', 'click', function(evt) {
- evt.preventDefault();
- var origanalUrl = $(this).attr('href');
- var hrefRegEx = /^(^/?{[A-Za-z_]*/?)?([A-Za-z_]+)(.php)$/
- var hashUrl2 = origanalUrl.replace(hrefRegEx, '$2');
- var hashUrl = '#' + hashUrl2;
- var urlExt = ' #ajaxTarget';
- var newUrl = origanalUrl + urlExt;
- if(!$(hashUrl).html() && hashUrl != '#index') {
- $(hashUrl).load(newUrl).ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
- newMain = $(hashUrl);
- newHeight = newMain.outerHeight();
- alert(newHeight);
- $('#textBox_main').animate({
- height: newHeight
- }, 500, function() {
- newMain.fadeIn(500);
- });
- oldMain = newMain;
- });
- } else {
- isLoaded = true;
- }
- $(hashUrl).load(newUrl, function(response, status, xhr) {...} );
- var fired = false;
- $(document).delegate('.links', 'click', function(evt) {
- evt.preventDefault();
- var origanalUrl = $(this).attr('href');
- var hrefRegEx = /^(^/?{[A-Za-z_]*/?)?([A-Za-z_]+)(.php)$/
- var hashUrl2 = origanalUrl.replace(hrefRegEx, '$2');
- var hashUrl = '#' + hashUrl2;
- var urlExt = ' #ajaxTarget';
- var newUrl = origanalUrl + urlExt;
- if(!$(hashUrl).html() && hashUrl != '#index') {
- var ajax = $(hashUrl).load(newUrl);
- if (!fired) {
- ajax.ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
- newMain = $(hashUrl);
- newHeight = newMain.outerHeight();
- alert(newHeight);
- $('#textBox_main').animate({
- height: newHeight
- }, 500, function() {
- newMain.fadeIn(500);
- });
- oldMain = newMain;
- });
- fired = true;
- }
- } else {
- isLoaded = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement