Let op! Nadat u de wijzigingen hebt opgeslagen is het wellicht nodig uw browsercache te legen.
- Firefox / Safari: houd ⇧ Shift ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-⇧ Shift-R op een Mac)
- Google Chrome: druk op Ctrl-⇧ Shift-R (⌘-⇧ Shift-R op een Mac)
- Internet Explorer: houd Ctrl ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5
- Opera: leeg uw cache in Extra → Voorkeuren
mw.loader.localLoad( 'Gebruiker:DarkShadowTNT/modernizr.js' );
$(function() {
if (Modernizr.history) {
// history is supported; do magical things
} else {
// history is not supported; nothing fancy here
}
});
history.pushState(stateObject, "title", URL);
$(function() {
if (Modernizr.history) {
// history is supported; do magical things
// hijack the nav click event
$("nav").delegate("a", "click", function() {
_href = $(this).attr("href");
// change the url without a page refresh and add a history entry.
history.pushState(null, null, _href);
// load the content
loadContent(_href); // fear not! we're going to build this function in the next code block
});
} else {
// history is not supported; nothing fancy here
}
});
// set up some variables
var $mainContent = $("#content"),
$pageWrap = $("#pageWrapper"),
baseHeight = 0,
$el;
// calculate wrapper heights to prevent jumping when loading new content
$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() - $mainContent.height();
function loadContent(href) {
$mainContent
.find("#global-wrapper")
.fadeOut(200, function() { // fade out the content of the current page
$mainContent
.hide()
.load(href + " #global-wrapper", function() { // load the contents of whatever href is
$mainContent.fadeIn(200, function() {
$pageWrap.animate({
height: baseHeight + $mainContent.height() + "px"
});
});
$("nav a").removeClass("current");
$("nav a[href$='" + href + "']").addClass("current");
});
});
}
$(window).bind("popstate", function() {
link = location.pathname.replace(/^.*[\\/]/, ""); // get filename only
loadContent(link);
});