We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

Urgent help needed with a website for Uni

Hi guys,

I am trying to implement something on a website I am making. And need a Java script. Or some help creating one.

Basically on a page I have four little thumbnails of pets. And I want some sort of script whereby when you hover over them the image appears larger in a SET space.

Can anybody help?

It is due in tommorow haha

Cheers
Live for what tomorrow has to bring, not what yesterday has taken away

Comments

  • I think I may be able to help, do you need the coding written here?
  • Should you maybe not have left this till the last minute. I could have helped show you how to do it with more time, but I'm not going to write the code out here
  • M4RKM
    M4RKM Posts: 5,132 Forumite
    1,000 Posts Combo Breaker
    image swap does this.. but you just tweak it to have the changed image in the second place, and swap the image with a larger version

    and if you know what i mean by that, it'll take you half an hour to sort out.
  • jaydeeuk1
    jaydeeuk1 Posts: 7,714 Forumite
    Debt-free and Proud!
    Peasy.


    function showImg(theimage)
    !!
    document.getElementById('bigimage').innerHTML='<img src="images/'+theimage+'.jpg">'

    }


    Bang that in a script tag

    in your html, have your 4 thumbnail images. I'll do one image as an example

    <img src="images/littlepic1" onmouseover="showImg('bigpic1')">
    number each image consecutively

    create a div element for your large image

    <div id="bigimage"></div> - position this absolute if you want

    Name each image littlepic1, littlepic 2
    and large version bigpic1, bigpic2 etc

    You'll also need a function to hide the bigpic image when you move the mouse out, but I'm not writing the entire thing for you ;)

    Haven't tested code and a little hungover, but you get the idea...
  • The OP isn't going to learn anything with people doing it for them. And they've had plenty of time to sort it out.

    I predict another useless !!!!!! being churned out with an IT related degree and nack all idea. Not to worry. If they settle in E.Yorks, it's yet another opportunity for me to make money sorting out their mess.
    Conor
    Unstoppable.....
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.9K Banking & Borrowing
  • 254.3K Reduce Debt & Boost Income
  • 455.2K Spending & Discounts
  • 246.9K Work, Benefits & Business
  • 603.5K Mortgages, Homes & Bills
  • 178.3K Life & Family
  • 261K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.