jquery - Multiple issues with pushstate: history, loading, calling functions -
i have script pulling data via ajax/pushstate; works relatively well, there issues i'm running into. first , foremost, here code i'm using:
function goto(href) { $.ajax({ url: href, success: function(data) { $('#wrapper').fadeout('fast', function(){ $(this).html(data).fadeto('fast', 1); $(".scroll").nicescroll({cursorcolor:"#f33d39", cursorwidth: "10px", cursorborder: "none", cursorborderradius: "0px", fixed: true}); }); // update page title var title = $('#page-right').find('h1').text(); $('head').find('title').text(title); } }); } if (typeof history.pushstate !== "undefined") { var historycount = 0; $('a[href*="rage.rage-wrestling.com"]').live('click',function(){ var href = $(this).attr('href'); $('#page-load').fadein( 'slow' ); goto(href); $('#page-load').delay(2000).fadeout( 'slow' ); history.pushstate(null, null, href); return false; }); window.onpopstate = function(){ if(historycount) { goto(document.location); } historycount = historycount+1; }; }
now, code pulls data need , displays i'm running several issues i've attempted problem solve no avail. follows:
the button not work on browser.
the title pages 1 page behind; i.e. if i'm on page called cain , click link go other, when page loads other displays title of page on browser cain. seems lapse. it's strange.
i can't seem find way call function ragecharts(); in this; i've put after ajax load have nicescroll refiring in order work, breaks code. i've tried in popstate function well, not work. need able re-call function because when data loaded page , function being used, doesn't display data correctly.
the loading function; i've jerry rigged it, speak, having #page-load div called before ajax pulled overlay , set delay afterwards, want overlay fade out once of data has loaded inside ajax call. there lot of images still need loaded time overlay fades out , want stay until it's loaded.
that's pretty it.
i've trouble shot as feasibly could, i'm novice when comes stuff maybe there's i'm not seeing correctly.
thanks in advance if you're able assist.
Comments
Post a Comment