Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Using Chris’ Dynamic Page / Replacing Content – how do I update the index page title?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #39080
    bestify
    Participant

    I’m using Chris’ Dynamic Page / Replacing Content code to load content into a div.

    What I’d like to know is how can I update the title of the index page to that of the page from which the external content is loaded from?

    For instance, when I load content from project_1.html which has the title tag:

    Project 1

    into my div, I want the index page title to show ‘Project 1’

    Here’s the code I’m using to do the ajax loading:

    $(function() {

    var newHash = "",
    $mainContent = $("#main-content"),
    $pageWrap = $("#page-wrap"),
    $newtitle = "",
    $el;

    $(document).delegate(".dyn 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(200, function() {
    $mainContent.hide().load(newHash + " #guts", function() {
    $mainContent.fadeIn(200, function() {
    $pageWrap.animate({

    });


    });
    $(".dyn a").removeClass("current");
    $(".dyn a[href="+newHash+"]").addClass("current");
    });
    });
    };

    });

    $(window).trigger('hashchange');


    });

    Could someone be kind enough to explain what I need to add to make this work and where in the code to add this.

    Many thanks in advance!

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.