Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-31-2013, 05:51 PM   PM User | #1
xanderwhite
New to the CF scene

 
Join Date: Jan 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
xanderwhite is an unknown quantity at this point
Scalable image menu not working with Javascript

Hi,
I'm probably doing something daft here, but I haven't been able to figure it out, so after 4hrs trying I'll try and explain...
I'm trying to build a scalable image based menu for my front page, to direct my clients to various sites depending on their choice, up until now the image size has been fixed, which isn't so great for iPad's, iPhones....you catch my drift. So I've pretty much hacked my site and got the image scalable, but I'm struggling with the hit areas as they don't seem to be able to position themselves properly (left to right) despite lots of attempts to make them behave. I can manually line them up in css, but because it's a dynamically sized image that breaks everything on different size screens, so I'm having to take a crash course in Javascript.

My test page is currently at http://www.purephotos.co.uk/test-menu/ and hopefully you will be able to see what I'm trying to do. The code that moves the hit areas around should all be visible in the source code view as I'm using Javascript in the page to do the work for me.

Any help getting everything lined up would be hugely appreciated.

Thanks in advance
xanderwhite is offline   Reply With Quote
Old 01-31-2013, 10:00 PM   PM User | #2
student101
Regular Coder

 
student101's Avatar
 
Join Date: Nov 2007
Posts: 610
Thanks: 80
Thanked 13 Times in 13 Posts
student101 is on a distinguished road
Each image looks to be 166px in width.
Code:
#region1{
left:0;
}
#region2{
left:166;
}
... & so on
u get it?
__________________
Thanks for your support!
Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

Give thanks & resolve when done :thumbsup:
student101 is offline   Reply With Quote
Old 01-31-2013, 10:10 PM   PM User | #3
xanderwhite
New to the CF scene

 
Join Date: Jan 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
xanderwhite is an unknown quantity at this point
That won't work because the image is scalable so for you it's 166, for me it's 250 which would make the hit areas all wrong on my screen, the 'left' attribute has to be set onLoad so we know how big the image is and therefore how big the hit area needs to be. Hence the JavaScript.
Thanks for trying!
xanderwhite is offline   Reply With Quote
Old 01-31-2013, 10:52 PM   PM User | #4
student101
Regular Coder

 
student101's Avatar
 
Join Date: Nov 2007
Posts: 610
Thanks: 80
Thanked 13 Times in 13 Posts
student101 is on a distinguished road
I would use a different style sheet 4 each resolution.

__________________
Thanks for your support!
Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

Give thanks & resolve when done :thumbsup:

Last edited by student101; 02-01-2013 at 12:40 PM..
student101 is offline   Reply With Quote
Old 02-01-2013, 09:18 AM   PM User | #5
xanderwhite
New to the CF scene

 
Join Date: Jan 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
xanderwhite is an unknown quantity at this point
As I said....
Quote:
I can manually line them up in css, but because it's a dynamically sized image that breaks everything on different size screens
So that's a hell of a lot of resolutions to cater for.... try it, resize your browser to any size and refresh, the image changes to match your browser size. It's not like there is a minimum size it can go. The maximum is easy though it's 900px wide and won't go bigger than that. But downsizing...it goes all the way. And I need maximum compatability, I'm not just setting this up for specific devices, it needs to work on any screen of any size! Hence the scalable image.
Does anyone else have any ideas?

Last edited by xanderwhite; 02-01-2013 at 09:33 AM..
xanderwhite is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:56 AM.


Advertisement
Log in to turn off these ads.