JQuery address plugin help

I have a site with ajax content uploaded. Now I want to implement a jQuery address plugin for a better user experience and search query scanning.

Using this line $.address.value($(this).attr('href')); change of address works, but how can I do history support, scanning, etc.?

There is something with $.address.change(function(event){...}); what should i do but what? I tried putting $("#content").load(toLoad,'',showNewContent) and other thousands of things in it, unfortunately, without results.

The documentation is really poor: http://www.asual.com/jquery/address/docs/

This is my code:

 $('a:not([href^=http])').click(function() { var toLoad = $(this).attr('href') + " #ajaxedContent"; $("#content").fadeOut(600,loadContent); $("#load").remove(); $('#logo').append('<div id="load"></div>'); $("#load").fadeIn(100); $.address.value($(this).attr('href')); function loadContent() { $("#content").load(toLoad,'',showNewContent) } function showNewContent() { // Capture the final dimensions of the content element and animate, finally fade content in $("#limit").animate({height: $("#content").height()},600,'easeInOutQuad',function() { $("#content").fadeIn(600,hideLoader); callback(); }); } function hideLoader() { $("#load").fadeOut(300); } return false; }); 

The main implementation is as follows:

 $.address.change(function(event) { // do something depending on the event.value property, eg // $('#content').load(event.value + '.xml'); }); $('a').click(function() { $.address.value($(this).attr('href')); }); 

Any help would be greatly appreciated. Thanks.

+4
source share
1 answer

So it works:

 $.address.init(function(event) { $('a:not([href^=http])').address(); }).change(function(event) { var toLoad = event.path + " #ajaxedContent"; $("#content").fadeOut(600,loadContent); $("#load").remove(); $('#logo').append('<div id="load"></div>'); $("#load").fadeIn(100); function loadContent() { $("#content").load(toLoad,'',showNewContent) } function showNewContent() { // Capture the final dimensions of the content element and animate, finally fade content in $("#limit").animate({height: $("#content").height()},600,'easeInOutQuad',function() { $("#content").fadeIn(600,hideLoader); callback(); }); } function hideLoader() { $("#load").fadeOut(300); } return false; }); 
+3
source

All Articles