HiveMedia / TheHiveRadio

This repository is for The Hive Radio's (https://hiveradio.net) website
Other
0 stars 1 forks source link

Fluid page changing via AJAX page loading #31

Open KatelynHaworth opened 9 years ago

KatelynHaworth commented 9 years ago

I have been toying with page changing via AJAX so that users can use the player while changing pages with out the stream stopping and them having to press play again.

Currently I can change the page content using this little snip-it of code

jQuery.ajax({ type: "GET", url: "https://hiveradio.net/about", cache: false, dataType: "html", success: function(data) { newPageContent = jQuery("

").html(data).find('.site-content'); $('.site-content').fadeOut(250, function() { $(this).html(newPageContent); $(this).fadeIn(250); }); } });

This code retrieves the content of the new page and switches out the current content with the new content. This code can be expanded upon to allow it to change the page's tile, the sidebar menu and anything else that changes cross pages