browserstate / ajaxify

Ajaxify your entire website instantly with this simple drop-in script using the HTML5 History API with History.js and jQuery ScrollTo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Three questions about ajaxify

bildlich opened this issue · comments

I hope this is the right place to ask these questions.

  • How does ajaxify determine which DOM elements are the content and menu containers? I haven't seen a way to pass a selector.
  • Are ajax requests cached so that a repeated request for the same link is executed faster?
  • The last questions is more related to History.js: In ist readme I've only found examples with URLs like www.mysite.com/?state=1. Can it handle pretty URLs like www.mysite.com/state/1 as well?

This may be an old post but for folks stumbling across it. I can answer the first question. If you take a look at the ajaxify.js you see / find the following:

/* Application Specific Variables */
contentSelector = '#container',
$content = $(contentSelector).filter(':first'),
contentNode = $content.get(0),
$menu = $('#menu,#nav,nav:first,.nav:first').filter(':first'),
activeClass = 'current-menu-item',
activeSelector = '.current-menu-item',
menuChildrenSelector = '> li,> ul > li',
completedEventName = 'statechangecomplete',
/* Application Generic Variables */
$window = $(window),
$body = $(document.body),
rootUrl = History.getRootUrl(),
scrollOptions = {
duration: 0,
easing:'swing'
};

Menu container is this line:

$menu = $('#menu,#nav,nav:first,.nav:first').filter(':first'),

and content container is this line;

contentSelector = '#container',

Hope that helps.