Implementation of JQuery pop-up box positioning

Source: Internet
Author: User

Code:
Copy codeThe Code is as follows:
// Page code (simplified)
<Asp: TextBox ID = "tbOperation2" runat = "server" onclick = "buttonclick ($ (this ))"
CssClass = "ui-button-icons-only" Text = "button"> </asp: TextBox>
<Div id = "editdialog" title = "Basic dialog">
<Div>
<Label onclick = "clickEdit ();" class = "labelbutton">
Edit </label>
</Div>
<Div>
<Label onclick = "clickView ();" class = "labelbutton">
View </label>
</Div>
<Div>
<Label onclick = "clickBuild ();" class = "labelbutton">
Build </label>
</Div>
</Div>



<Script type = "text/javascript"> // when the page is initialized
Var staticsignal;
$ (Function (){
// A workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$ (": Input. ui-button-icons-only"). button (); // change the textbox Style
});
</Script>

<Script type = "text/javascript">
Function buttonclick (e)
{
Var offset = e. offset (); // get the offset
Var x = offset. left;
Var y = offset. top;
$ ("# Editdialog"). dialog ({
AutoOpen: true,
Draggable: true,
Resizable: false,
Position: [x, y + 35], // you can specify coordinates.
Width: 150
});
$ (". Ui-dialog-titlebar"). hide ();
$ ('A. ui-dialog-titlebar-close'). hide ();
Staticsignal = e;
}
</Script>

Haha is actually very simple, but it contains a lot of things. For details, refer to the relevant materials ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.