CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    73

    turn cursor into magnefying lens?

    Hello,
    I was wondering if there are any scripts available which will help me transform the mouse cursor into a magnefying lens once it hovers over an image. I think that onmouse.hover will be what I need, but what about the image of the lens? Are there any images like this ready?

    Thank you!

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: turn cursor into magnefying lens?

    You can change enlarge the image (examples are everywhere here at CG, just search), but you cannot magnify parts of the image.

    I hope that answers your question. If not, please explain.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    May 2006
    Posts
    306

    Re: turn cursor into magnefying lens?

    http://www.dynamicdrive.com/
    There's a magifying box script in there somewhere, just modify it to show only on the picture onmouseover

    here, i found it
    http://www.dynamicdrive.com/dynamicindex3/zoom.htm

    try this
    HTML Code:
    <style>
          .Tooltip
          {
              border:1px solid black;
              font-size:10px;
              layer-background-color:lightyellow;
              background-color:lightyellow;
              position: absolute;
          }
          A
          {
              color: blue;
          }
        </style>
        <script language="javascript">
            var tip = new Array();
            // add as many tips as you want
            // if you want html in tips, then change "Tooltip.innerText" to "Tooltip.innerHTML"
            function TipShow(current, e, num)
            {
                Tooltip.innerText = tip[num];
                Tooltip.style.height = 15;
                Tooltip.innerHTML += "<br/><img src='" + current.src + "'/>";
                Tooltip.style.visibility = "visible";
            }
            
            function UpdateMouse()
            {
                Tooltip.style.left = event.clientX + document.body.scrollLeft;
                Tooltip.style.top = event.clientY + document.body.scrollTop + 20;
            }
            function TipHide()
            {
                Tooltip.style.visibility = "hidden";
            }
    </script>
    <img src="your img"onmouseover="TipShow(this,event,[tip array number]);" onmouseout="TipHide();"
    for each image that you want to enlarge, add
    HTML Code:
    onmouseover="TipShow(this,event,[tip array number]);" onmouseout="TipHide();"
    if you want to add image sizes, go to where it says Tooltip.innerHTML += "<br/><img src='" + current.src + "'/>";
    and add a height and width setting
    Last edited by code?; November 4th, 2006 at 09:28 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured