How to set popup position?
I work on Asp.Net vs08 C# .I want to show popup ** Bottom** of the button .Not on center of page.Here is my syntax .
Aspx code:
<input id="Button3" type="button" value="Open 1" />
Jquery:
<script type="text/javascript">
$(function() {
$("#Popup").dialog({
bgiframe: true,
autoOpen: false,
height: 300,
modal: true,
buttons: {
Cancel: function() {
$(this).dialog("close");
}
},
close: function() {
allFields.val("").removeClass("ui-state-err开发者_C百科or");
}
}).parent().appendTo($("form:first"));
$("#Button3").click() {
$("#Popup").dialog("open");
});
});
</script>
show me syntax or modify my syntax. Thanks.
You'll need to add a position
field to your options argument:
<script type="text/javascript">
$(function() {
$("#Popup").dialog({
bgiframe: true,
autoOpen: false,
height: 300,
modal: true,
position: [100, 200], // 100 is x location, 200 is y location, in pixels
buttons: {
Cancel: function() {
$(this).dialog("close");
}
},
close: function() {
allFields.val("").removeClass("ui-state-error");
}
}).parent().appendTo($("form:first"));
$("#Button3").click() {
$("#Popup").dialog("open");
});
});
</script>
position
can also accept a string like "top"
or "left"
.
See the jQuery UI Dialog documentation for more information about this.
Just add the Position keyword to your query like
position: [400, 500]
精彩评论