Home   News  Product reviews  Website reviews  Forums   Competitions  Subscribe 


Web Building >> Web design & build
 |  Print Topic
Jump to first unread post. Pages: 1
clum111
regular


Reg'd: Wed
Posts: 436
Rolling your mouse over an image to enlarge it?
      #357056 - Wed Jul 11 2007 03:07 PM

Hi All,

I'm wondering if it's possible to roll your mouse over images to enlarge them to a certain size without having the image opening in a new window and is it simple?

Cheers


Post Extras: Print Post   Remind Me!   Notify Moderator  
Zippy_Brown
regular


Reg'd: Fri
Posts: 88
Loc: /dev/null
Re: Rolling your mouse over an image to enlarge it? [Re: clum111]
      #357137 - Wed Jul 11 2007 11:02 PM

Is this what you are looking for?

http://javascript.about.com/library/blroll1.htm

--------------------
Zippy


Post Extras: Print Post   Remind Me!   Notify Moderator  
clum111
regular


Reg'd: Wed
Posts: 436
Re: Rolling your mouse over an image to enlarge it? [Re: Zippy_Brown]
      #357190 - Thu Jul 12 2007 01:51 PM

Hi Zippy_Brown,

Thanks for the link, but I'm now stuck. I am putting 20 images onto a page and there will be 9 pages. So to make it easier for myself, I'm planning to have 1 page 20 images in 9 seperate folders, so I know where things are.

I think I have followed the first part of that "fact sheet" correct by creating an img.js file. Here is the scrip:-

if (document.images) {
image0 = new Image;
image1 = new Image;
image2 = new Image;
image3 = new Image;
image4 = new Image;
image5 = new Image;
image6 = new Image;
image7 = new Image;
image9 = new Image;
image10 = new Image;
image11 = new Image;
image12 = new Image;
image13 = new Image;
image14 = new Image;
image15 = new Image;
image16 = new Image;
image17 = new Image;
image18 = new Image;
image19 = new Image;
image0.src = 'graphics\/img.jpeg';
image1.src = 'graphics\/img1.jpeg';
image2.src = 'graphics\/img2.jpeg';
image3.src = 'graphics\/img3.jpeg';
image4.src = 'graphics\/img4.jpeg';
image5.src = 'graphics\/img5.jpeg';
image6.src = 'graphics\/img6.jpeg';
image7.src = 'graphics\/img7.jpeg';
image8.src = 'graphics\/img8.jpeg';
image9.src = 'graphics\/img9.jpeg';
image10.src = 'graphics\/img10.jpeg';
image11.src = 'graphics\/img11.jpeg';
image12.src = 'graphics\/img12.jpeg';
image13.src = 'graphics\/img13.jpeg';
image14.src = 'graphics\/img14.jpeg';
image15.src = 'graphics\/img15.jpeg';
image16.src = 'graphics\/img16.jpeg';
image17.src = 'graphics\/img17.jpeg';
image18.src = 'graphics\/img18.jpeg';
image19.src = 'graphics\/img19.jpeg';
} else {
image0 = '';
image1 = '';
image2 = '';
image3 = '';
image4 = '';
image5 = '';
image6 = '';
image7 = '';
image9 = '';
image10 = '';
image11 = '';
image12 = '';
image13 = '';
image14 = '';
image15 = '';
image16 = '';
image17 = '';
image18 = '';
image19 = '';
document.rollimg = '';
}

Then I have put the next script into my page in the "head" section:-

<script type="text/javascript" src="img.js">
</script>

In the next part of the "fact sheet" it says:-

THe first thing to do is to add all of the smaller images to your page exactly as you normally would and also place the first of the larger images where you want it to appear. You then surround each of the smaller images with a span tag that contains an onmouseover call that sets document.rollimg.src to the preloaded copy of the larger version of that image. The only other change that you need to make is to add name="rollimg" to the image tag for the larger image so that the rollovers will know which imige it is that is to be replaced.

Here is the code from the sample page so that you can see what these additions look like, the span tags around the first of the smaller images as well as the name attribute on the larger image are shown in bold:

<p align="center"><span onmouseover="document.rollimg.src=image0.src;">
<img src="graphics/pic1.gif" width="32" height="32" border="0" alt="1" /></span> <span onmouseover="document.rollimg.src=image1.src;">
<img src="graphics/pic2.gif" width="32" height="32" border="0" alt="2" /></span> <span onmouseover="document.rollimg.src=image2.src;">
<img src="graphics/pic3.gif" width="32" height="32" border="0" alt="3" /></span>
</p>
<p align="center"><img src="graphics/pic1a.gif" width="150" height="150" border="0" alt="Larger version of one of the smaller images above" name="rollimg" /></p>

Now I'm stuck. I've put all my 20 images onto the page where I want them and put the first large image onto the page as well.

I don't know what to edit from the scrippt or how. Also do I need to list all 20 images in the script for each image that is on the page?

I would be grateful if you could help me out please.

Cheers


Post Extras: Print Post   Remind Me!   Notify Moderator  
Zippy_Brown
regular


Reg'd: Fri
Posts: 88
Loc: /dev/null
Re: Rolling your mouse over an image to enlarge it? [Re: clum111]
      #357271 - Thu Jul 12 2007 11:10 PM

If you could PM me a link to your website where I can see your efforts so far, I will be able to take a look and guide you better.

--------------------
Zippy


Post Extras: Print Post   Remind Me!   Notify Moderator  
Zippy_Brown
regular


Reg'd: Fri
Posts: 88
Loc: /dev/null
Re: Rolling your mouse over an image to enlarge it? [Re: Zippy_Brown]
      #357381 - Fri Jul 13 2007 08:49 PM

Just had a look and sent you step by step instructions for the few changes you need to make.

Hope it works out for you.

--------------------
Zippy


Post Extras: Print Post   Remind Me!   Notify Moderator  
TheFatControlleRAdministrator
Forum Admin


Reg'd: Fri
Posts: 6556
Loc: Megatripolis
Re: Rolling your mouse over an image to enlarge it? [Re: Zippy_Brown]
      #357401 - Fri Jul 13 2007 11:17 PM

Any chance you can share that information so others on the forum can benfit?

Post Extras: Print Post   Remind Me!   Notify Moderator  
Zippy_Brown
regular


Reg'd: Fri
Posts: 88
Loc: /dev/null
Re: Rolling your mouse over an image to enlarge it? [Re: TheFatControlleR]
      #357421 - Sat Jul 14 2007 07:43 AM

I would have normally posted the information here, but in this case it was a site specific thing. The information would have been no use to anyone else as it contained information about his particular website.

The full instructions are provided if you follow the link I posted earlier: http://javascript.about.com/library/blroll1.htm

--------------------
Zippy


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1

Rate this topic

Jump to


Extra information
0 registered and 20 anonymous users are browsing this forum.

Moderator:  putasolutions, Joe_London, greysts, bricat, Nanook, Hello_There, John_McKenna, Mouse, TheFatControlleR 


Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      Mark-up is enabled

Rating:
Topic views: 0

Contact Us | Privacy statement Main website