弹出式表单-定位和样式

Pop Up form - Positioning and Styling

本文关键字:样式 定位 表单 弹出式      更新时间:2023-09-26

所以我有了这个弹出式表单,它工作得很好,但它不让我控制它弹出的位置,即使当我尝试应用CSS时它也不起作用。此外,表单应该在<aside>表单中,但它没有显示在那里。

html

的代码如下
    <aside>
        <form method="post" class="basic-frm" id="newFolder">
            <label>
                <h1>New Folder</h1>
            </label>
            <label>
                <span>Title:</span>
                <input id="title" type="text" name="title"/>
            </label>
            <label>
                <span>Description</span>
                <input id="description" type="text" name="description"/>
            </label>
            <input id="submit" type="submit" name="submit" value="Submit" class="button"/>
            <input id="cancel" type="button" name="cancle" value="Cancel" class="button"/>
        </form>
        <h1>Welcome</h1>
        <img src="images/newFolder.svg" onmouseover="this.src='images/newFolderHover.svg'" onmouseout="this.src='images/newFolder.svg'" id="clicky">
        <p>New folder</p>
    </aside>

Jquery代码如下:

$(document).ready(function(){
    $('#newFolder').dialog({
        autoOpen: false,
        width: 600
    });
    $('#clicky').button().click(function() {
        $('#newFolder').dialog("open")
    });
    $('#cancel').button().click(function() {
        $('#newFolder').dialog("close")
    });
});

CSS,比如颜色和其他东西都可以但宽度不行,边距不行,不管怎样,我还想让它留在<aside>中,但它不是

您还应该指定position:

$( ".selector" ).dialog({ 
    position: { my: "left top", at: "left bottom", of: "aside" } 
});

这将允许你将对话框相对于另一个元素('aside'选择器)定位。

查看jQuery UI Dialog API

我假设在你的css中你有一些代码来定义你的"aside"标签的样式…

在你的CSS中为你的标签添加一些坐标,如valign: top: bottom…对齐:左,中心,…等等

和HTML代码

<aside>
    <h1>Welcome</h1>
        <img src="images/newFolder.svg" onmouseover="this.src='images/newFolderHover.svg'"   onmouseout="this.src='images/newFolder.svg'" id="clicky">
        <p>New folder</p>
        <form method="post" class="basic-frm" id="newFolder">
            <label>
                <h1>New Folder</h1>
            </label>
            <label>
                <span>Title:</span>
                <input id="title" type="text" name="title"/>
            </label>
            <label>
                <span>Description</span>
                <input id="description" type="text" name="description"/>
            </label>
            <input id="submit" type="submit" name="submit" value="Submit" class="button"/>
            <input id="cancel" type="button" name="cancle" value="Cancel" class="button"/>
        </form>

    </aside>
我的欢迎部分应该放在最上面,不是吗?