Hi folks,

I'm having difficulty understanding how to get Klaus's history plugin working in my application. I have an "ebook" application in which the page has a static index of pages which, when an individual link is clicked, a file is loaded into an adjacent div (#ebook).

Upon being loaded, the file is scanned and any a.linkto tags are scanned for as these tags are my "between" page links which I was hoping to get the history plugin to capture and do its magic. Once found, the a.linkto tags are prepared - as far as I can understand - for the history plugin. However, my attempt has gone all pear-shaped and I cannot find any reference/article/documentation via Google to help me see my error.

What tends to happen is that upon clicking an a.link from within #ebook, a copy of the entire current page, sans the targetted page, is loaded into #ebook.

Any help would be appreciated - even if it is a suggestion to try a different approach.

Thanks, Bruce

$(document).ready(function() {
        $.ajaxHistory.initialize();
        var pgname = $('a.eb0').attr('id');
        fnGetEbookFile(pgname);
});

function fnGetEbookFile(pgname){
$.get('textfiles/' + pgname + '.html?q=' + new Date().getTime(),function(txt){
                $("#ebook").html(txt).show();
                $('a').each(function() {
                        var $a = $(this);
                        var theid = $a.attr('id');
                        var q = $a.attr('class');
                        if (q=='linkto') {
$a.attr("id",'#textfiles/' + theid + '.html').remote('#ebook').bind("click",function() {fnGetEbookFile(theid);});
                        };
                });
    });
}; 

Reply via email to