在div中保留jQuery对话框 [英] Keep a jQuery dialog in a div

查看:86
本文介绍了在div中保留jQuery对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建许多jQuery对话框,但我想将它们的位置限制在父div内.我正在使用以下代码创建它们(顺便说一句,oppacity选项也不起作用...):

I am trying to create a number of jQuery dialogs but I would like to constrain their positions to inside a parent div. I am using the following code to create them (on a side note the oppacity option is not working either...):

var d= $('<div title="Title goes here"></div>').dialog({
            autoOpen: true,
            closeOnEscape: false,
            draggable: true,
            resizable: false,
            width: dx,
            height: dy
        });

        d.draggable('option', 'containment', 'parent');
        d.draggable('option', 'opacity', 0.45);

        $('#controlContent').append(d.parent());

推荐答案

我找到了一种方法.现在这是我创建对话框的方法:

I have found a way to do it. This is now my method for creating a dialog:

    var d = $('<div title="Title"></div>').dialog({
        autoOpen: true,
        closeOnEscape: false,
        resizable: false,
        width: 100,
        height: 100
    });

    d.parent().find('a').find('span').attr('class', 'ui-icon ui-icon-minus');
    d.parent().draggable({
        containment: '#controlContent',
        opacity: 0.70
    });

    $('#controlContent').append(d.parent());

这篇关于在div中保留jQuery对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆