/ Published in: JavaScript
Use the rel attribute to specify which "html" file to load. In this case the link is set to the "About" page and will load the about.html file with AJAX and update the site's title and address.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//HTML LINK <a href="/about" rel="address:/about" title="About" >About</a> //START CHANGE FUNCTION $.address.change(function(event) { //THE LINK var theLink = event.value; //AJAX $.ajax({ url: $.address.baseURL() + theLink +'.html', context: document.body, success: function() { $('#container').css({opacity:0}).fadeTo('normal',1); }, complete: function() { $('#container').load($.address.baseURL()+ theLink +'.html'); } //END AJAX }); //END CHANGE FUNCTION }); //CHANGE SITE TITLE $('a').click(function(){ $.address.title($(this).attr('title')); });
URL: http://www.asual.com/jquery/address/