View Single Post
Old 05-23-2011, 06:19 AM  
nation-x
Confirmed User
 
nation-x's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
I am not following what you want exactly, however, this is easily accomplished with jQuery. You can either use the toggle() method or add and subtract css classes with the click() method. The best way would be to add a classname to each of the links like this:

Code:
<div id="main"></div>
<a href="page1.html" class="pager">Page One</a>
<a href="page2.html" class="pager">Page Two</a>

<script>
jQuery(document).ready(function() {
    jQuery(".pager").click(function() {
        jQuery("#main").load(jQuery(this).attr('href'));
    });
});
</script>
In this example, I did something a little different than you described. When you click the link it will use ajax to load the content from the page in the link href attribute to the main div. I am assuming that this would accomplish the same goal without having to have all of the content included in the page by default.
nation-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote