Hi i'm doing a project for college using jquery, i'd like to dynamically update a section when a link button is clicked
without reloading the page, the content fades out and the new content fades in, but when i click on a link the content fades out but the new content doesn't fade in, any suggestions, is there a better way of doing this???
$(function() {
var newHash = "",
$mainContent = $("#main-content"),
$pageWrap = $("#page-wrap"),
baseHeight = 0,
$el;
$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() - $mainContent.height();
$('#list_nav li a').click(function() {
window.location.hash = $(this).attr("href");
return false;
});
$(window).bind('hashchange', function(){
newHash = window.location.hash.substring(1);
if (newHash) {
$mainContent
.find("#guts")
.fadeOut(500, function() {
$mainContent.hide().load(newHash + " #guts", function() {
$mainContent.fadeIn(500, function() {
$pageWrap.animate({
height: baseHeight + $mainContent.height() + "px"
});
});
$("nav a").removeClass("current");
$("nav a[href='"+newHash+"']").addClass("current");
});
});
};
});
$(window).trigger('hashchange');
});