![]() |
Javascript height sums don't match
I have a div, absolutely positioned, originally non-visible that is shown at the position of an element icon (in elements listing) being clicked rendering its preview (top position of the preview is lined to the top of the icon clicked).
When the element being clicked is positioned low on the page, the preview is rendered somewhat below the original page border, and scrolling is necessary. I want to move the preview upward to have its bottom edge on the previous page bottom limit. The problem is the code I use doesn't return what is expected for the page height (it is greater than the sum of the preview height and the clicked-element top position). Here's the code: file 1: Code:
jQuery('elementClicked').live('click',function(){Code:
jQuery.fn.setTopAtClickedElement = function (element) {Here is the visual look of what I am trying to explain, and here's the jsfiddle. Do you have any suggestions on how I should implement this troublesome part of the code? Please tell if I wasn't clear enough. Thank you very much for the time. |
You do not want to have your low PREVIEW's bottom edge on the previous page bottom limit. If user looks at element 1 and the bottom element The popup will look stupid. The following code puts the bottom of the popup on the bottom of the page. This works out OK until we use more viewing elements and extend the page.
To see this simple use enough anchors to fill a page; things will work good. Than add a couple and see the difference. What I would do and didn't (because I thought it would complicate the coding too much) Is to force the hidden elements to show. I used document.getElementById("previewPopup").innerHTML = "To Low To Show"; to prove I was manipulating the correct popups. Just take both of those out to use this. Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| All times are GMT +1. The time now is 12:14 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.