//iWebKit 6.0 Fullscreen + Slide + touch=hover function hijackLinks() { $('a').live("click", function (e) { e.preventDefault(); loadPage(e.target.href); $(this).addClass('click'); }); if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {$('a').live("touchstart", function (e) { direction = $(this).attr('class'); $(this).addClass('temp'); setTimeout(function () { $('.temp').addClass('click'); }, 100); }); $('a').live("touchmove", function (e) { $('.temp').removeClass('temp'); setTimeout(function () { $('.click').removeClass('click'); }, 1);}) $('.click').live("touchend", function (e) { setTimeout(function () { $('.click').removeClass('click'); }, 1);})} else{ $('a').live("mouseenter", function (e) { direction = $(this).attr('class'); $(this).addClass('click');}) $('a').live("mouseleave", function (e) { $(this).removeClass('click');}) } } function loadPage(url) { if (url === undefined) { $('body').load('url', 'header:first,#content,footer', hijackLinks); window.history.pushState(null, null, url); } else { $.get(url, function (data) { $('body').append(data); sm = $(window).width(); sn = $(window).scrollTop(); window.scrollTo(0,0); window.history.pushState(null, null, url); if (direction === "leftnav") { $('body>header:last,body>#content:last,footer:last').css("-webkit-transform", "translate( -" + sm + "px,0px)"); footerheight = $('body>#content:last').outerHeight(false) + $('body>header:last').outerHeight(true); $('footer:last').css("top", footerheight); $('body>header,body>#content,footer').css("-webkit-transition-duration", "0.4s"); $('body>header:first,body>#content:first,footer:first').css("-webkit-transform", "translate(" + sm + "px,0px)"); $('body>header:last,body>#content:last,footer:last').css({"-webkit-transform": "translate(0,0)"}); $('body>header:last a,body>header:last div,body>header:last h1').css({'-webkit-transition': 'opacity 0.4s linear','opacity':'1'}); $('body>header:first a,body>header:first div,body>header:first h1').css({'-webkit-transition': 'opacity 0.4s linear','opacity':'0'}); } if (direction !== "leftnav") { $('body>header:last,body>#content:last,footer:last').css("-webkit-transform", "translate(" + sm + "px,0px)"); footerheight = $('body>#content:last').outerHeight(false) + $('body>header:last').outerHeight(true); $('footer:last').css("top", footerheight); $('body>header,body>#content,footer').css("-webkit-transition-duration", "0.4s"); $('body>header:first,body>#content:first,footer:first').css("-webkit-transform", "translate( -" + sm + "px,0px)"); $('body>header:last,body>#content:last,footer:last').css("-webkit-transform", "translate(0,0)"); $('body>header:last a,body>header:last div,body>header:last h1').css({'-webkit-transition': 'opacity 0.4s linear','opacity':'1'}); $('body>header:first a,body>header:first div,body>header:first h1').css({'-webkit-transition': 'opacity 0.4s linear','opacity':'0'}); } setTimeout(function () { $('body>header:not(:last),body>footer:not(:last),body>#content:not(:last)').remove(); $('body>header,body>footer,body>#content').removeAttr('style'); },1000); }); } } $(document).ready(function () { loadPage(); window.addEventListener("popstate", function(e) { if (direction === leftnav) { direction = rightnav; } else { direction = leftnav; } loadPage(location.pathname);}); });