不能弹出div

时间:2015-04-20 09:44:06

标签: javascript jquery css asp.net

寻找How to position 400 x 400px popup div relative to click, keeping in screen view

的建议

我正在加载一个jquery pop up div。麻烦是因为它显示在屏幕中间我无法将其显示在屏幕顶部...

<script>
        $(function () {
                        $("#saveDialogSingleFeature").dialog();
                    });
</script>

    <div style="display: none;">
                <div id="saveDialogSingleFeature" title="Save Complete">
                    <p>
                        You have successfully saved 1 feature.</p>
                </div>
            </div>

正如我所说div打开正常我只需要更改它显示的位置。我试过了:

<script type="text/javascript">
        $('#saveDialogSingleFeature').css({ 'top': 10, 'left': 10 });
    </script>

并将一个.saveFeaturePopUp类添加到div ...

<style type="text/css">
         .saveFeaturePopUp
         {
            position: {my: "top", at: "bottom", of: $("header")};
         }
     </style>

但无济于事。请指教

1 个答案:

答案 0 :(得分:2)

你应该只需要在你的CSS中设置Position:absolute。

<script type="text/javascript">
        $('#saveDialogSingleFeature').css({position: 'absolute', 'top': 10, 'left': 10 });
    </script>