If this make no sense you can stop me as i am just guessing right now because i haven't used the Jquery dialog.
So using .offset or .closest().offset you will get the position of the dialog box (or div contains it (?)). After that you can do a subtraction of the page window.height , width or document.height, width to get the relevant position of the dialog within the page and go from there. Just a thought here, not sure it's doable.
Thanks - .offset was where I needed to go! I looked at .position as I was quitting last night and it didn't seem right...
At any rate - this code works. Note that I had to use .innerWidth and .innerHeight to account for the padding (but not the borders). Nice thing about the OVERLAY div is that it covers the entire DOCUMENT - so it's at 0,0 making the clientX and clientY really work nicely!
Code:
function graphGrid(strId, objGraph, blnDoReader) {
blnInGraph = true;
var wesPC = $("#" + strId);
.
.
.
var wesCols = wesPC.find(".slick-header-column");
var wesCol = [];
for (var i = 0; i < wesCols.length; i++) {
wesCol = $(wesCols[i]);
g_graphCols.push({ offset: wesCol.offset()
, height: wesCol.innerHeight()
, width: wesCol.innerWidth()
, name: wesCol.find(".slick-column-name").html()
});
}
.
.
.
function overlayClick(sender) {
if (blnInGraph) {
$('.acs-dlg-graph-item').val('');
for (var i = 0; i < g_graphCols.length; i++) {
if (sender.clientX >= g_graphCols[i].offset.left && sender.clientX <= g_graphCols[i].offset.left + g_graphCols[i].width
&& sender.clientY >= g_graphCols[i].offset.top && sender.clientY <= g_graphCols[i].offset.top + g_graphCols[i].height) {
$('.acs-dlg-graph-item').val(g_graphCols[i].name);
}
}
}
}
And it looks like this!!
Last edited by szlamany; Nov 24th, 2013 at 07:21 AM.
*** Read the sticky in the DB forum about how to get your question answered quickly!! ***
Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".