View Full Version : Need image viewer help

05-11-2009, 11:37 AM
I'm trying to modify a javascript template to display pictures in a rolling display. However, the template sets all the variables in pixels which means when changing resolutions, the object changes position. I'm no pro, so try and explain things clearly if that is okay :)

The actual position is set with "pagePositionLEFT" and "PagePositionTOP". How do I set these values to percentages?

This is the code that the javascript currently refers to:

// Image Viewer Dimensions settings (pixels):
var PagePositionLEFT = 830; // Set position of Image viewer from LEFT of page
var PagePositionTOP = 220; // Set position of Image viewer from TOP of page

var InterFaceWidth = 500; // Set [Overall] WIDTH |||| minimum length=300
var ViewingAreaHeight = 160; // Set [Viewing area] HEIGHT |||| minimum length=10

var OverALLBorder = 'on'; // Set [Over All] Border 'on' or '' (blank) for off

// Image Viewer Colors [example: 'red' or '#FF0000']
var OverALLBorderColor = '2E5B89'; // Set color of [Over All] Border

var ControlsBGColor = '709FCF'; // Set color of [Control Area] Background |||| use '' = no color
var ControlsFontColor = '2E5B89'; // Set color of [Control Area] Font

var ViewAreaBGColor = 'ECF2F9'; // Set color of [Viewing Area] Background |||| use '' = no color

var ImageBorderColor = '2E5B89'; // Set color of [Image] Border

var ButtonBGColor = 'ECF2F9'; // Set color of [Button] Background
var ButtonFontColor = 'black'; // Set color of [Button] Font
var ButtonBorderColor = 'white'; // Set color of [Button] border

// Image Alignment
var ImageValignment = 'middle'; // Set verticle alignment within viewer (options: top, bottom. middle)

var ImageArray = new Array



Apprepriate thanks for any help!

rnd me
05-11-2009, 10:57 PM
PagePositionLEFT = screen.width* 0.75;

note that there's lot of way to get widths: actual, window, screen, specific elements, etc.

furthermore, just for extra fun, many of these names and values vary by browser, docType, and OS.