www.webdeveloper.com
Results 1 to 4 of 4

Thread: mousevover image positioning

  1. #1
    Join Date
    Mar 2012
    Location
    Latvia
    Posts
    7

    mousevover image positioning

    hi there web nation.
    i am whstuck in one problem. so what i am trying to do is to position mooseover image. it is not very difficult, bet here is on what i am stuck.

    <A HREF="some.html" onmouseover="document.poga.src='supusclick.png'"
    onmouseout="document.poga.src='supportus.png'">

    <img src="suportus.png" id="poga">

    this is the code which i use for mouseover, but problem is in that the image which apears after mouseover event moves litle bit right. it is because it has different width and i useed gimp to make it transparent so there is one small part in picture which makes it wider then starting image.

    so i liked to know how can i possition onmouseover image.

  2. #2
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,216
    If there is a small difference between sizes of images, why not just resize the images used to all have the same width/height?

  3. #3
    Join Date
    Mar 2012
    Location
    Latvia
    Posts
    7

    Unhappy

    what i was thinkin to do make an seperate image objects and asign each of them different positions as i use transparency for images. but i have no ideas where to strat. ir must be someking javascript and css combination.
    this is how far i have got but javascript functions does not work.

    <html>
    <head>
    <script type="text/javascript">
    var bilde=new Array();

    bilde[0]=new Image;
    bilde[0].src="supusclick.png";
    bilde[1].src=new Image;
    bilde[1].src="supportus.png";

    function mouson()
    {
    document.getElementById("poga").src=bilde[0];
    }

    function mouseout()
    {
    document.getElementById("poga").src=bilde[1];
    }
    </script>
    </head>

    <body>

    <img src="supportus.png" id="poga" onmouseover=mouson() onmouseout=mouseout()>

    </body>

    </html>

  4. #4
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,216
    If you are having problems with the JavaScript, you might want to ask for help on it in the JavaScript section. I'm not much at working with JS.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles