0
對於wordpress主題,當你將它們轉過去時,我會將彩色圖像轉換爲黑白圖像。但是,當你移動鼠標的速度非常快時,圖像會保持黑色,直到你再次瀏覽它們。jQuery:卡住jquery動畫
我該如何解決這個問題,以確保當我不把圖片懸停時,它不會停留在黑色&白色?
鏈接到演示:http://www.infictus.com/wordpress_demo/creafolio/
代碼:
function initImage(obj)
{
var $newthis = $(obj);
if ($.browser.msie)
{
$newthis = $newthis.desaturateImgFix();
}
$newthis.addClass("pair_" + ++paircount);
var $cloned = $newthis.clone().attr('id', '');
$cloned.get(0).onmouseover = null;
$cloned.insertAfter($newthis).addClass("color").hide();
$newthis = $newthis.desaturate();
$newthis.bind("mouseenter mouseleave", desevent);
$cloned.bind("mouseenter mouseleave", desevent);
};
function desevent(event)
{
var classString = new String($(this).attr('class'));
var pair = classString.match(/pair_\d+/);
// first I try was $("."+pair).toggle() but IE switching very strange...
$("."+pair).hide();
if (event.type == 'mouseenter')
$("."+pair).filter(":not(.color)").show();
if (event.type == 'mouseleave')
$("."+pair).filter(".color").show();
}
這不是一個WordPress的問題...這是一個jQuery的問題。請相應地更改您的標題。 – EAMann 2010-11-04 19:03:39
哦,是的,對不起 – Christophe 2010-11-04 20:48:15