Jquery and SWF Address 1.3.2


/ Published in: JavaScript
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. //HTML LINK
  2. <a href="/about" rel="address:/about" title="About" >About</a>
  3.  
  4.  
  5. //START CHANGE FUNCTION
  6. $.address.change(function(event) {
  7.  
  8. //THE LINK
  9. var theLink = event.value;
  10.  
  11. //AJAX
  12. $.ajax({
  13. url: $.address.baseURL() + theLink +'.html',
  14. context: document.body,
  15. success: function() {
  16. $('#container').css({opacity:0}).fadeTo('normal',1);
  17. },
  18.  
  19. complete: function() {
  20. $('#container').load($.address.baseURL()+ theLink +'.html');
  21. }
  22.  
  23. //END AJAX
  24. });
  25.  
  26. //END CHANGE FUNCTION
  27. });
  28.  
  29.  
  30.  
  31. //CHANGE SITE TITLE
  32. $('a').click(function(){
  33. $.address.title($(this).attr('title'));
  34. });

URL: http://www.asual.com/jquery/address/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.