Haha...its madness!
I am working on a new in-page web content editor for the company I work for. I have a site that's divided into 3 sections. Its got a left-nav menu, a header, and a content area. Now, it seems simple enough to have a button just above the content area that would switch the layer of the content area to a little content editor with the content already in it. That parts easy.
The hard part.
I've got the div that contains the editor hidden initally, so that when the button is clicked, the first layer is hidden and the editor's layer is revealed. The editor's layer has a dynamically height-adjusted IFRAME that is supposed to increase to the page that it contains. The editor page is in that IFRAME. The EDITOR PAGE is dynamically height-adjusted itself..doesn't it seem like it would naturally work well together??
NO. See, because the problem is this. The function which dynamically adjusts the height of the IFRAME calculates the height of the page within it and then sets the height of the IFRAME accordingly. Still seems straight-forward right? Well, then you remember that the page being calculated is dynamic in height as well....and well, .......you may have guessed: it calculates it as having next to no height at all. AGH..
Any Solution in Sight?
I'm not sure that there's going to be a simple fix for this. I may just stick to what I just now figured out. That is, that if I set the height of the IFRAME when I define it in the HTML code, and set it to 100%, then it will automatically stretch to the height of the table that its in. So if my menu expands to be much longer (which it does if you click on certain items..) then it will expand the IFRAME as well. I would much rather have it adjust according to the actual height of the page within the editor.
Perhaps though, ...perhaps if I set the PRE tag that is replaced with the editor and the page content so that it is 100% height and the overflow is auto, then maybe it will stretch by itself to the full height of the content in the page and therefore automatically adjust the IFRAME to that height. AGH - no that didn't work either.
You know... oh wait a sec..time for a cheesy sub title.
Reconsidering..
On second thought, I really don't want it to go the full length of the content. No, not really at all. You know what I really want? I'm gonna tell you right now.
I want this IFRAME to adjust simply to the height of the window that you have open. That's IT! No more, no less. I want it to just fit in your window. See because I don't want the editor's main buttons to scroll out of view. Now how do I tell google this so that the search results will come up with the solution?
Well, ok...I figured it out. My table just wasn't being set to 100% height. Once I did that, and set the IFRAME height to 100%, then it behaved similar to what I had in mind originally. Now come to think of it....this is more what I want, because if I did the other way, ...how would I make it automatically stretch bigger upon scrolling down if perhaps it were shorter than the rest of the page (like the menu for example)? That would be ..(pardon the pun) a real stretch.
I think I'll leave it at that for now.
And better things to come..
I've got these other cool ideas to implement now. Like:
- Making the abort button actually switch back to the regular content layer so you don't have to refresh.
- Making the full screen button ACTUALLY go full-screen...probably by making changes to the layer so that its absolutely positioned 0px by 0px top-left, and making its width and height 100%.
- Making every link on the menu simply change whats in the content and contentEditor layers rather than going to another page (avoiding refresh..)
I would love it for it to do these things like I want. Then it will really have the feel of an application rather than a life-less site.

No comments:
Post a Comment