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 02-02-2010, 09:54 AM   PM User | #1
jasonelmore
New to the CF scene

 
Join Date: Feb 2010
Location: Campbellsville Ky
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jasonelmore is an unknown quantity at this point
Question Need help, point me in the right direction. Image map/browser

Someone please point me in the right direction. Basically what i'm trying to do is, Post up a nice image map up top of a page with several diff images (all same dimensions), and when the user clicks on one of the images, it loads down in a section below, without reloading the page.

I have drawn a small diagram to show you guys what i'm talking about. So far, all I've found, are scripts that use some sort of lightbox that covers the entire page.

I would like to try to stay away from flash if I can. The main browser, does'nt necessarily have to be one big image with a map, but it would make it look so much better if it looked matched the games menu. I'm trying to replicate a stats game menu, inside my webpage, so ppl can browse just like they do in game.

Example:



What I'm trying to replicate:



When a weapon on this menu is clicked, it loads up on the right, and gives a brief description. I"m just trying to replicate the functionality of this menu really.

So are there any kind of scripts out there that already exist, where I could accomplish this? or how would i go about this.

just need someone to point me in the right direction. Thanks a million
jasonelmore is offline   Reply With Quote
Old 02-02-2010, 10:08 AM   PM User | #2
Dormilich
Senior Coder

 
Dormilich's Avatar
 
Join Date: Jan 2010
Location: Behind the Wall
Posts: 2,880
Thanks: 9
Thanked 291 Times in 287 Posts
Dormilich is on a distinguished road
basicly all you need to do is change the src attribute of the large picture, according to the thumbnail image clicked.
Dormilich is offline   Reply With Quote
Old 02-02-2010, 11:26 AM   PM User | #3
hey
New Coder

 
Join Date: Jan 2010
Posts: 38
Thanks: 0
Thanked 13 Times in 13 Posts
hey is an unknown quantity at this point
You can do something like this:

Code:
<html>
  <head>
    <script type="text/javascript">
    function change(imgPath)
    {
      document.getElementById('largeImage').src = imgPath;
    }
    </script>
  </head>
  <body>
    <div>
      <img src="http://www.w3schools.com/jS/b_pink.gif" onmouseover="change('http://www.w3schools.com/jS/b_pink.gif')"/>
      <img src="http://www.w3schools.com/TAGS/planets.gif" onmouseover="change('http://www.w3schools.com/TAGS/planets.gif')" />
    </div>
    <div>
      <img src="http://www.w3schools.com/jS/b_pink.gif" width="300" height="300" id="largeImage" />
    </div>
  </body>
</html>
You can learn a bit more about the code here:

http://www.w3schools.com/jS/tryit.as...ryjs_animation

Last edited by hey; 02-02-2010 at 11:29 AM..
hey is offline   Reply With Quote
Old 02-02-2010, 07:18 PM   PM User | #4
jasonelmore
New to the CF scene

 
Join Date: Feb 2010
Location: Campbellsville Ky
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jasonelmore is an unknown quantity at this point
Thanks, that is for mouseover tho. Are there any small scripts that already exist that i can maybe modify?

I'm not good at writing this stuff from square one.
jasonelmore is offline   Reply With Quote
Old 02-02-2010, 08:14 PM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,209
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Just change onmousover to onclick

Presto.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Old 02-03-2010, 09:22 AM   PM User | #6
jasonelmore
New to the CF scene

 
Join Date: Feb 2010
Location: Campbellsville Ky
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jasonelmore is an unknown quantity at this point
alright, how do I specify the event to go to a specific div? Again, i'm really a beginner when it comes to this.
jasonelmore is offline   Reply With Quote
Old 02-03-2010, 10:27 AM   PM User | #7
Dormilich
Senior Coder

 
Dormilich's Avatar
 
Join Date: Jan 2010
Location: Behind the Wall
Posts: 2,880
Thanks: 9
Thanked 291 Times in 287 Posts
Dormilich is on a distinguished road
put an id to the <div> and use document.getElementById()
Dormilich is offline   Reply With Quote
Reply

Bookmarks

Tags
browser, image, javascript, map

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:46 PM.


Advertisement
Log in to turn off these ads.