Question

I was searching here but didn't got sufficient answer. I'm using following test case, but Back / Forward buttons are not working properly:


function handleChange(evt){

    if (evt.pathNames[0] == '!text'){

      $('div#ajax').load('text.php');

    } else if (evt.pathNames[0] == 'contact') {
        //load contact page
    } else {
        //load default page
    }

}

SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);

I can't find too much about this functionality together with Ajax calls, any suggestion please ? Seems, that Gmail has something similar, but working for mailbox navigation..

Thanks, Ivan

Was it helpful?

Solution

Finally I got the point. It's working, but my TESTING of it was WRONG.

Forward / back buttons are working well, however, back button to 'BLANK' home page was not working, because there simply wasn't rule to match blank parameter. Now it seems like this:

function handleChange(evt){

var path = evt.path;

switch(path) {

  case '':  // go home
      $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/index/uvod');

  break;

  case '!domov':    // go home
      $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/index/uvod');

  break;


  case '!pridaj':
      $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/pridaj');
  break;

  case '!uprav':
          $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/uprav');
  break;

  case '!oprojekte':
          $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/index/oprojekte');
  break;      

  case '!kontakt':
          $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/kontakt');
  break;

  case '!podmienky':
          $('#ajax_ramec').html('<div style="margin-left: 50%; margin-top:50%; text-aligtn:center"><img src="'+baseURL+'/public/images/template/loading_small.gif" /></div>').load(baseURL+'/index/podmienky');
  break;

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top