Changing URL after ajax event.
So I have a navigation I am working on that could be adaptable to any site. You click on a link and new content arrives with fade in / out. Pretty standard. However, I would like the URL to change so it can be copy/pasted and/or bookmarked. The code below works, but the fades don't work. Also, I know this 'breaks the back button' and I plan to tackle that next.
- $(document).ready(function() {
- $("#nav a").click( function ( event ) {
-
- event.preventDefault();
-
- if ( !$(this).is(".current") ) {
-
- var url = $( this ).attr( "href" );
-
- $( "#nav a" ).removeClass( "current" );
-
- $( this ).toggleClass( "current" );
-
- $( "#content-container" ).fadeOut( "slow", function() {
-
- $("#content-container")
- .load( url + " .content" )
- .fadeIn(1500);
-
-
- });
- window.location.replace(url);
-
- };
-
- });
-
- /* This Ends click */
- });
- /* This ends jQuery */