【问题标题】:How to show/hide div from imagemap inside jquery window?如何在 jquery 窗口内的图像映射中显示/隐藏 div?
【发布时间】:2011-03-04 22:19:32
【问题描述】:

我创建了一个翻转图像地图来显示牛肉块。当用户点击一段牛肉时,会通过 js/popupbox.js 脚本显示一个 div,其中将列出食谱。

所有基本脚本都在工作here(点击“Chuck”部分)

但首先牛的图像地图在 jquery 模态窗口中打开(我是 jquery 的新手,可能指错了!)。 问题:my show/hide div ceases to work inside of the jquery window.

我考虑过使用工具提示脚本,但用户必须能够通过单击自己打开/关闭 div,因为每个 div 内都会有食谱和其他内容,他们需要能够点击.

非常感谢任何帮助!

【问题讨论】:

    标签: jquery show-hide tooltip imagemap


    【解决方案1】:

    您需要使用 open 事件将事件处理程序附加到对话框。

    $('#opener').click(function() {
        $('#dialog').dialog({
            modal: true,
            height: 550,
            width: 800,
            hide: "explode",
            open: function() {
                $(this).click(function() {
                    $('#popupbox').show();
                });   
            }
        });
    });
    

    工作示例:http://jsfiddle.net/f55gg/

    【讨论】:

    • 感谢您的回复,nolabel。我尝试了您的建议,但现在弹出模式窗口似乎不起作用。示例:lydiarobertsdesign.com/testground/cow/beefchart2.html
    • $('#opener').click(function() { $('#dialog').dialog({ modal: true, height: 550, width: 800, hide: 'explode' , 打开: function() { $(this).click(function() { $('#popupbox').show(); }); } }); });这对我有用。我在您的代码中看到的唯一区别是您将单引号和双引号混合在一起,使用其中一个。你有 hide: "explode",应该是 hide: 'explode',
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-28
    • 2013-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多