0

I am attempting to create a static microsite that has a list of pages. I have a main file 'index.php' with a list of links like the following:

<a href="/pages/page1.php">Go to page 1</a>

<a href="/pages/page2.php">Go to page 2</a>

What I'm trying to do is something like (http://voiceandtone.com/) where when you click on a page it fades-out the current page you are on and animates in the new page without refreshing the page.

Does anyone know how I can achieve this or if there are any great tutorials out there that can help me?

cusejuice
  • 10,285
  • 26
  • 90
  • 145
  • read about jQuery ajax get. ((google it) – Royi Namir Jul 29 '13 at 20:58
  • possible duplicate of [How AJAX is done in github source browse?](http://stackoverflow.com/questions/9041872/how-ajax-is-done-in-github-source-browse) – Quentin Jul 29 '13 at 20:58
  • There are dozens of single page frameworks. My choice was `backbone` and now `chaplin` because of coffeescript. You can also change pages with some good looking [few `css3` transitions](http://tympanus.net/Development/PageTransitions/). – cr0 Jul 29 '13 at 21:04
  • Like others have said you will want to use Ajax to load the pages, you will also want to use history.js to take care of changing the URLs. Check out this http://stackoverflow.com/a/13314438/1429895 . This is a very good example in jsfiddle that will do what you are trying to do. – David Stetler Jul 29 '13 at 21:50

2 Answers2

1

Maybe somethig like this ?

$(document).ready(function() {
    $("a").click(function() {
         $('#result').load("http://domain.com" + $(this).attr('href'), function(){
            // Stuff to do after the page is loaded
         });
    });
});

here is documentation http://api.jquery.com/load/

David
  • 1,829
  • 20
  • 31
-1

The answer is Ajax. You can use either the GET or POST method to achieve your task.

Sarvap Praharanayuthan
  • 4,212
  • 7
  • 47
  • 72