jQuery common popup for a set of elements
I want a popup so that I'm listing a lot of co开发者_如何学Cntacts and there is a provision for sending messages. Can I use a single popup and move it around the DOM such that when I click on a send message link the popup will be shown near the link I googled and searched for it a while couldn't see a modal.
You can set the location of the dialog result using
$( ".selector" ).dialog( "option", "position", [200,300] );
And you can get the mouse pointer location (which assuming the link is near the contact will be approximately the right location (you might need to tweek it)) so would something like this do the trick:
$( ".selector" ).dialog( "option", "position", [window.event.clientX,window.event.clientY]);
$( ".selector" ).dialog( "option", "open");
position --> http://jqueryui.com/demos/dialog/#option-position
mouse --> http://www.devx.com/tips/Tip/29285
精彩评论