2011-07-10 80 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