The Journal :: Nekkid, Clueless and Feelin' Good


Wednesday,
January 19, 2005

Every so often, I remind myself that I'm not a complete dork

Or: Melanie polishes her Geek Girl Crown

El Jefe asked me if I would take an app one of our developers wrote and give it a company-appropriate GUI (we have this down to an art by now -- the developer writes the code, and I make it look pretty).

No problem, I think. As El Jefe wanted it to coordinate with the new company look, I grabbed one of our nice new webpages, gutted it and got it ready for the code. And promptly ran into a bit of a hiccup -- the developer had written the app using layers, which are HTML elements that allow you to place something at a specific point on a screen. This is very nice if you want to lay out GUI elements with precision, but our company pages are centered tables, so if you resize the page the layers stay anchored to their original position, which makes it look like they're sliding out of place. It just looks sloppy, you know?

Oh, and I'd also never worked with layers before, but we won't go there.

So, after spending a rather frantic hour boning up on layers and their functions, I hunted around on the web and found a Dreamweaver extension called SnapLayer that allows you to anchor a layer to an image, layer or other element on a webpage. Bonzer, I think. I downloaded and installed it, used it to anchor the background layer to the header graphic, then tested it in IE and Netscape.

Well, it did work, technically, in that the background layer was indeed centered and anchored to the bottom of the header graphic. But when I resized the page, it slid out of position again on the horizontal plane. Bugger, I think, and go home, intending to install the extension on my home copy of Dreamweaver and noodle about some more. On the way home, though, it hit me -- the extension was working properly, but I need to refresh the page after I resize it.

In the words of Homer Simpson -- "D'oh!" When I got home, I downloaded the extension, whipped up a sample page, and by gum I was right -- when I resized it, then clicked Refresh, the anchored layer popped back into place.

But we can't ask our users to refresh the page every time they resize it (well, we COULD, but I doubt they'd bother, and the inelegance of it would annoy me). So I hopped online and started hunting around for code that would refresh a page automatically after it was resized. There's a meta tag for refreshing a page, but it acts as a loop, and I could just see the repeated flashing sending someone into an epileptic fit. Um, no. What I wanted was for the page to be refreshed only when someone resized it.

After another hour of hunting through sites, I found a fix -- an onResize command for IE and a snippet of Javascript that worked in Netscape and Safari. Installed those in the appropriate positions, tested the page -- and weelah, it worked in all three browsers!

And I'm just a lowly tech writer with a couple of week-long programming courses under my belt -- can you imagine what I could do if I actually knew what I was doing? Still, I rule.


<< Back   |  Email  |  Home  |  About  |   Forward >>

© 2007 Melanie Miller Fletcher   •   Website by Belaurient Web Design   •   Visitors: 235    Lions: 0