Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2009
    Thanked 0 Times in 0 Posts

    Need image viewer help

    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!

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 569 Times in 550 Posts
    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.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts