上周我还在Chrome 11上时,我的网站运行得很好。昨天当我做了新的Chrome12更新时,我注意到我的网站速度慢得多,几乎无法使用......
这是:http://emilevictorportenart.be/
关联的jquery文件是:
// copyright Portenart Emile-Victor
if ( (screen.width < 1024) || (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || ($.browser.msie) ) {
document.location = "mobile/";
}
;$(document).ready(function(){
//add keyboard span and hide it on the first screen
$('section#content').append('<span class="keyboardUse"><span>MAJ: plus d\'infos<br /> ←→/QD/WA: changer de projet<br /> ↑↓/ZS: changer d\'image</span></span>');
// caching DOM
var $keyboardUse = $('.keyboardUse');
var $headerNavUl = $('header nav ul');
var $navMainBottom = $('.navMainBottom');
var $headerNavSpanRelMore = $('header nav span[rel=more]');
var $headerNavA_Arrow = $('header nav a, .arrow');
var keyboardUseShowFirst = 0;
var clickLinkAllow = 1;
var $header = $('header');
$keyboardUse.hide();
// links
$('a[rel=external]').live('click', function() {
window.open(this.href);
return false;
});
// height navigation Background pattern
$navMainBottom.height(1000).css('top','-723px');
$header.find('h1 a').css('margin-top','65px');
// ul navigation slide when hover (1st time) & click next
$headerNavUl.hide();
$headerNavSpanRelMore.one('mouseover', function(){
$headerNavUl.slideDown(200);
$navMainBottom.animate({'top':'-800px'},200);
$(this).addClass('moreRotated');
});
$headerNavSpanRelMore.click(function(){
$(this).toggleClass('moreRotated');
if($headerNavUl.is(':visible')){
$navMainBottom.animate({'top':'-723px'},200);
} else {
$navMainBottom.animate({'top':'-800px'},200);
}
$headerNavUl.slideToggle(200);
});
// leave project animation
$('header nav a, .arrow').live('click', function(){
if(clickLinkAllow === 1){
$('section h1').css('z-index','-1').animate({'left':'-1000px'/* , 'top':'2000px' */},800);
$('article').css('z-index','-1').animate({'left':'-965px', 'top':'2000px', 'opacity':'0'}, 750);
$('.arrow').fadeOut(300);
$('header h1').animate({'left':'0', 'opacity': '1'}, 700);
var $keyboardUse = $('.keyboardUse');
if(keyboardUseShowFirst === 0){
$keyboardUse.addClass('full').fadeIn(200);
setTimeout(function(){
$keyboardUse.removeClass('full');
}, 10000);
keyboardUseShowFirst = 1;
} else {
$keyboardUse.show();
}
}
});
// caption
$('article span[rel=more]').live('click', function(){
$(this).toggleClass('moreRotated');
$('article .description').slideToggle(200);
});
// keyboard
//stop keyboard action when input/textarea are on focus
var inputTextareaFocus = 0;
$('input, textarea').live('focus', function(){
inputTextareaFocus = 1;
});
$('input, textarea').live('blur', function(){
inputTextareaFocus = 0;
});
$(document.documentElement).keyup(function (event) {
if(inputTextareaFocus === 0){
if (event.keyCode == 37 || event.keyCode == 81) { //left -- q
$('header nav ul a[rel=active]').parent().prev().find('a').click();
} else if (event.keyCode == 39 || event.keyCode == 68) { //right -- d
$('header nav ul a[rel=active]').parent().next().find('a').click();
} else if (event.keyCode == 38 || event.keyCode == 90) { //top -- 90
$('.naviSquare li[rel=active]').prev().find('a').click();
} else if (event.keyCode == 40 || event.keyCode == 83) { //down --
$('.naviSquare li[rel=active]').next().find('a').click();
} else if (event.keyCode == 16) { //caps (maj)
$('.naviSquare li:eq(0) a').click();
$('article span[rel=more]').click();
}
}
return false;
});
// projeft change
//hide description and start waypoint
function afterload(timeToLoadWaypoint){
var $description = $('.description');
$description.hide();
setTimeout(function(){
var idliNavisquare = 0;
$('article figure img').waypoint(function(event, direction){
if (direction === 'down') {
idliNavisquare++;
}
else {
idliNavisquare--;
}
var $naviSquareLi = $('.naviSquare li');
$naviSquareLi.removeAttr('rel');
$naviSquareLi.eq(idliNavisquare).attr('rel','active');
});
$('body').css({'overflow-y':'scroll', 'overflow-x':'auto'});
//numbers of pictures and add squares
var $articleFigureUlLi = $('article figure ul li');
var nombreCreationLi = $articleFigureUlLi.length;
for (var i = 0; i < nombreCreationLi; i++) {
$articleFigureUlLi.eq(i).attr('id','crea'+i);
}
for (var i = 0; i < nombreCreationLi; i++) {
var tHeightImg4NaviSquare = $('figure li:eq('+i+') img').height();
var tailleHeightNaviSquareFinal = parseInt((tHeightImg4NaviSquare / 700)*10, 10);
var $ulNaviSquare = $('ul.naviSquare');
if(i === 0){
$ulNaviSquare.append('<li rel="active"><a href="#content" style="height:'+ tailleHeightNaviSquareFinal +'px;"></li>');
} else {
$ulNaviSquare.append('<li><a href="#crea'+i+'" style="height:'+ tailleHeightNaviSquareFinal +'px;"></a></li>');
}
}
//allow localscroll on this links
$('ul.naviSquare, .description').localScroll();
$('.arrow').fadeIn(100);
//add links on arrows
var hrefPrevious = $('header nav ul a[rel=active]').parent().prev().find('a').attr('href');
var hrefNext = $('header nav ul a[rel=active]').parent().next().find('a').attr('href');
$('a[rel=prev]').attr('href', hrefPrevious);
$('a[rel=next]').attr('href', hrefNext);
//add share links
var linkPageActive = 'http://emilevictorportenart.be/%23'+window.location.hash.substr(1);
var titrePageActive = $('article h2').text();
titrePageActive = titrePageActive+' from Emile-Victor Portenart Website';
var descriptionPageActive = $('article .description p:eq(0)').text();
descriptionPageActive = descriptionPageActive+' '
var twitterShareLink = 'http://twitter.com/share?url='+linkPageActive+'&via=portenartev&text='+titrePageActive;
var facebookShareLink = 'http://www.facebook.com/sharer.php?u='+linkPageActive+'&t='+titrePageActive;
var gmailShareLink = 'https://mail.google.com/mail/?view=cm&fs=1&tf=1&su='+titrePageActive+'&body='+linkPageActive;
$('a.share.twitter').attr('href',twitterShareLink);
$('a.share.facebook').attr('href',facebookShareLink);
$('a.share.gmail').attr('href',gmailShareLink);
clickLinkAllow = 1;
//contact from http://tutorialblog.org/how-to-create-your-own-ajax-contact-form/
$('#contactForm').submit( function(){
//hide the form
$('#contactForm').hide();
//show the loading bar
$('aside').append('<span class="loadingBar">loading...</span>');
$('.loadingBar').css({display:'block'});
//send the ajax request
$.get('contact_mail.php',{name:$('#name').val(), email:$('#email').val(), message:$('#message').val()},
//return the data
function(){
//hide the graphic
$('.loadingBar').css({display:'none'});
$('aside').append('<span>Merci pour votre mail, vous recevrez une réponse au plus vite.</span>');
});
//stay on the page
return false;
});
}, timeToLoadWaypoint);
}
//if url
if(!window.location.hash){
// animation d'entrée
var $blackLine = $('.black-line');
var $header = $('header');
var $frontContainer = $('.front #container');
$blackLine.css('left','-500px');
$frontContainer.css('top','-1000px');
$('.front .hideNavigation, header nav').hide();
$('header h1, section h1, article').css({'z-index':'-1','left':'-1000px'});
$header.css('background-image','url(img/headerBack41.png)');
$('.header2').css({'top':'-1000px', 'left':'500px'}).show();
setTimeout(function(){
$frontContainer.animate({'top':'0'}, 400, 'easeOutCirc');
$('.header2').animate({'top':'0', 'left':'0'}, 600);
}, 1300);
setTimeout(function(){
$('.front .hideNavigation, header nav').fadeIn(1200);
$('section h1').animate({'left':'0'}, 700);
$('article').animate({'left':'0'}, 800);
$blackLine.animate({'left':'798px'}, 700);
$('.black-line.bl2').animate({'left':'787px'}, 600);
$('.black-line.bl2.bl3').animate({'left':'776px'}, 700);
$header.find('h1').css({'z-index':'10','left':'940px', 'opacity': '0'});
$header.css('background-image','url(img/headerBack.png)');
$('.header2').fadeOut(100);
}, 1900);
}
//chargement du projet en temps normal
$('header nav a, .arrow').live('click', function(e) {
e.preventDefault();
if(clickLinkAllow === 1){
clickLinkAllow = 0;
$('body').css('overflow','hidden');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
var url = $(this).attr('href') + ' article, .arrow';
setTimeout(function(){
$('.load').html('loading...')
.css({'top':'-1000px', 'left':'490px' , 'opacity':'0'})
.load(url, function(){
$('.description').hide();
$('.arrow').hide();
});
}, 750);
setTimeout(function(){
$('.load').animate({'top':'0', 'left':'0' , 'opacity':'1'}, 1000);
}, 1300);
$('header nav a').removeAttr('rel');
var hash = window.location.hash.substr(1);
$('header nav a[href^='+ hash +']').attr('rel', 'active');
afterload(2000);
}
});
//bbq plugin
var clicked = 0;
$(window).bind('hashchange', function () {
var $body = $('body');
$('header nav a, .arrow').live('click', function(){
clicked = 1
});
if(clicked === 1){
clicked = 0;
} else {
//credit http://emanuelfelipe.net/themeforest/ajax-portfolio/
var hash = window.location.hash.substr(1);
var href = $('header nav a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html article, .arrow';
var $header = $('header');
$('.load').css({'top':'0', 'left':'0' , 'opacity':'1'}).load(toLoad, function(){
afterload(200);
});
$keyboardUse.addClass('full').show();
setTimeout(function(){
$keyboardUse.removeClass('full');
}, 10000);
$header.css('background-image','url(img/headerBack.png)');
$('.header2').hide();
$header.find('h1').css('z-index','999');
keyboardUseShowFirst = 1;
}
});
$('header nav a').removeAttr('rel');
$('header nav a[href^='+ hash +']').attr('rel', 'active');
$body.css('overflow-y','hidden');
setTimeout(function(){
$body.css('overflow-y','scroll');
}, 2000);
}
});
$(window).trigger("hashchange");
});
您也可以在此处找到它:http://jsfiddle.net/BXcHS/3/
这个网站是我一周内的最后一次考试,我不知道该怎么办,因为它在Firefox上运行得非常好,而且与Opera相当。