【问题标题】:Trying to hide image in dialog when mouseover another当鼠标悬停在另一个对话框上时,试图在对话框中隐藏图像
【发布时间】:2012-06-29 12:29:29
【问题描述】:

我很快意识到在对话框中编码 jquery 并没有遵循与父 DOC 中完全相同的语法。这就是为什么我的代码有 .live("mouseover"... 而不是 .mouseover(... 并且解决这个问题需要很长时间。 我有两个并排的图像缩小到它们全尺寸的 40%,以适应对话框中显示的 ajax 源表单。每个都有一个 id,当光标移过它时,我的代码会愉快地单独扩展每个图像。我想在发生这种情况时隐藏另一个,并在鼠标悬停时恢复现状,以免表格混乱。 mouseout 让我保持现状,但 mouseover 并没有隐藏其他图像。

    $('#cadovr').live('mouseover', function() {
    $(this).css('position', 'relative').height("100%").width("100%");
    $('#cadet').hide();
    }).live('mouseout',function() { 
    $(this).css('position', 'relative').height( "40%").width("40%");
    $('#cadet').show();
});
$('#cadet').live('mouseover', function() {
    $(this).css('position', 'relative').height("100%").width("100%");
    $('#cadovr').hide();
    }).live('mouseout',function() { 
    $(this).css('position', 'relative').height( "40%").width("40%");
    $('#cadovr').show();
}); 

有人知道为什么我必须在对话框中使用 .live 吗?

【问题讨论】:

    标签: image jquery-ui dialog mouseevent


    【解决方案1】:

    尝试使用mouseenter 而不是mouseover

    我已经看到这个工作,以为我不知道为什么。

    至于.live,Rab Nawaz 已经解释得很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多