Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    34
    Thanks
    12
    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:

    Code:
    // 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
    (
    
    'logo1.png', 
    'logo2.png',
    'logo3.pngg',
    'logo4.png'
    
    )
    Apprepriate thanks for any help!

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 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 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

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