开发者

jQuery: slow 'Webkit' performance - function .hover

开发者 https://www.devze.com 2023-01-20 13:05 出处:网络
Hey. I\'m trying to get this script to work smoothly in webkit (Safari, Chrome, newest versions). It runs absolutely fine in Firefox. This code is called in the document.ready function:

Hey. I'm trying to get this script to work smoothly in webkit (Safari, Chrome, newest versions). It runs absolutely fine in Firefox. This code is called in the document.ready function:

$('#noScript').remove();  
$("#content div.wrapper, #top div.wrapper").hide().stop().fadeIn({duration: 2000, queue: true });

$('#social a')
.children('span').hide()
.next('img').css('opacity', '0.4')
.parent().hover(function(){
    $(this).children('img').animate({ opacity : 0.99}, {duration: 100, queue: false })
    .prev('span').fadeIn({duration: 200, queue: false });
}, function(){
    $(this).children('img').stop().css({ opacity : 0.4})
    .prev('span').hide();
});

$('#language').css({opacity: '0.5'}).hover(function() { 
    $(this).animate({ opacity : 0.99}, {duration: 'fast', queue: false }) 
}, function(){ 
    $(this).animate({ op开发者_如何学Pythonacity : 0.5}, {duration: 'fast', queue: false }); 
});

Hovering over the selected items triggers an awfully slow animation. You can see a live example here: trinkaus.cc

Does anyone have any clue why this happens? Kind regards Sascha


It seems to be fine in Google Chrome 6.0.472.63 and IE 8, not had a chance to test it in Safari. Maybe clear your cache or something?


Wow, I think I have to answer my own question. The inset shadow on the #top div is the cause of the JS performance.

0

精彩评论

暂无评论...
验证码 换一张
取 消