2011-07-10 79 views
0

我有一個使用懸停效果的jQuery動畫,但然後通過單擊顯示圖像,然後單擊隱藏圖像。我希望能夠在div中添加一個鏈接以訪問源,但是,整個div由動畫點擊控制以關閉圖像。jquery多個點擊同一個div與動畫點擊

如何在同一個div內添加href點擊? 這裏的測試開發 http://mediacrunch.com/nick/animate6.htm

這是點擊事件之前設置代碼部分

$(function(){ 
    $("#wrapperimghov").hide(); 
    $("#wrapperimghov").fadeIn(6000); 
    $("img", this).hide(); 
    $("png", this).show(); 
    $(".divhov").hover(animated1, animated2);  
    $(".divhov") .toggle(animated3, animated4); 

} 
); 

function animated1() { 

    $(this).hoverFlow('mouseenter', { width: "30px", height:"420px" }, { queue: false, duration: 1000 }); 

} 
function animated2() { 

    $(this).delay(1200) .hoverFlow('mouseleave', { width: "10px" , height:"320px" }, { queue: false, duration: 1800}); 
$("img", this).fadeOut(1800), fadeoutcallback(); 

} 

現在是點擊事件

function animated3() { 
    $(this).animate({ width: "420px", height:"420px" }, { queue: false, duration: 800 }); 
    $("img", this).fadeIn("slow"), fadeoutcallback(); 
} 
function animated4() { 
    $(this).animate({ width: "10px" , height:"320px" }, { queue: false, duration: 800 }); 
    $("img", this).fadeOut("slow"), fadeoutcallback(); 

} 

function fadeoutcallback(){ 
$("img", this).hide(); 
} 

所以,我假設我需要另一個div以某種方式嵌套在可點擊div之外,或者,這是百萬美元的問題,我可以嗎?另一個鼠標指針指示不同的狀態顯示鏈接到href?

回答

0

http://jsfiddle.net/ave3q/

ev.stopPropagation()

+0

由於停止點擊事件,遺憾的是我現在才上傳了我的代碼,這說明不是一個而是兩個點擊事件,一個開放的形象和一個將其關閉。所以,這是第二次點擊干擾。 所以,我正在尋找一個不同的鏈接鼠標懸停尋找另一個href鏈接,或者我假設我需要包裝一個整體的div,並在其中,一個div的圖像和一個href鏈接。 你覺得呢? – jhanjon