View Single Post
Old 05-23-2011, 07:03 AM  
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
Quote:
Originally Posted by nation-x View Post
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.
Thanks, I'll play around with this a bit. it's a wordpress site so I would like to preload all the content on the page to make it easier for onsite editing.
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote