First Page Bug & Feature
-
First, great plugin, it’s exactly what I’m looking for thank you!
I have page say at: site.com/toc-test/
All the numbered pages (2,3,4,etc) all go forward and backwards fine. The initial page however, won’t load, as it goes to: site.com/toc-test/#toc-test
I’m a developer, checked my browser console log and the reason it was failing because it was trying to pull up: site.com/toc-test/toc-test/
This is odd, as it seems to work fine on your demo site and nobody’s mentioned it before, but I don’t think I’m doing anything special on my site. I guess it’s just appending a duplicate or not going to the parent level.
Second, easy feature mod. I have a pretty big header, and don’t want the plugin to go to the top top every time. Could you put in a text box next to that setting in that admin and let us put an id in there to scroll to? I imagine you just have a jquery slidto an id, this way we can slide to the top of the content, not the entire top of the site (which is what we want, esp if it’s a long ways down). That would be easiest I think!
Also, I notice in Safari there’s a white flash when loading the initial page. I’ve had a lot of issues with this when doing my own code, and it ha to do with the popstate being called twice by safari. There’s lots of things come up googling “safari ajax white flash” or the like. But I def think this would improve the appearance of the page not flashing in white twice.
Cheers mate!
————-
Here’s some code I wrote on it that may help:function initDynamicPage() { if(Modernizr.history){ $("nav").delegate("a", "click", function() { _link = $(this).attr("href"); history.pushState(null, null, _link); console.log('this is where the pop happens'); loadContent(_link); return false; }); function loadContent(href){ $mainContent .find("#guts") .fadeOut(200, function() { $mainContent.hide().load(href + " #guts", function() { $mainContent.fadeIn(200, function() { }); console.log(href); }); }); } var popped = ('state' in window.history && window.history.state !== null), initialURL = location.href; function inity(){ // Ignore inital popstate that some browsers fire on page load //no chrome initial load var initialPop = (!popped && location.href == initialURL); popped = true; if ( initialPop ) return; loadContent(_link); console.log("popstater: " + _link); } $(window).bind('popstate', inity); } // otherwise, history is not supported, so nothing fancy here. };
- The topic ‘First Page Bug & Feature’ is closed to new replies.