Re: Image Repositioning in ASP.NET

Discussion in 'ASP .Net' started by Vidar Petursson, Jun 4, 2004.

  1. Hi

    Make it position absolute
    <img style="position:absolute;top10px;left;20px" name="myImg"
    src="default.gif">

    Quick example that will preload the bigger image and display it when loaded
    10px from top + scrollTop
    <html>
    <head>
    <script>
    function loadBig(sSrc){
    var i = new Image();
    i.onload = dispImg;
    i.onerror = errHandler;
    i.src = "IMAGE_PATH/" + sSrc;
    }
    function dispImg(){
    with(document.images["myImg"])
    {
    src = this.src;
    style.posTop = (10 + parseInt(document.body.scrollTop,10));// Always 10 px
    from top
    }
    }

    function errHandler(){
    alert("Sorry image load error");
    }
    </script>
    </head>
    <body>
    <img onclick="loadBig('BIG1.jpg')" src="thumb1.gif">
    <img style="position:absolute;top10px;left;20px" name="myImg"
    src="default.gif">
    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    Just to show it does what intended :) <br>
    <img onclick="loadBig('BIG2.jpg')" src="thumb2.gif">
    </body>
    </html>

    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Visual: Scripting MVP 2000-2004
    http://www.icysoft.com/
    http://www.deus-x.com/ Instant e-commerce
    http://www.microsoft.com/technet/scriptcenter/
    Playground: http://213.190.104.211/ ( IE 5.5+ only )

    No matter where you go there you are
    ==============================
    "PhoenixFalconhand" <> wrote in message
    news:%...
    > Begginners' question:
    >
    > I am trying to make a small webform application that doesn't use frames.
    > The application is supposed to show some thumbnails on the left, and
    > whenever you click on one of them, the large image shows on the right
    > side.
    > The tricky part is when I scroll down the thumbnails and the big image
    > on the right stays on the top of the webform and is not visible anymore.
    >
    > The solution I thought of is that every time the button is pressed I
    > would reposition the big image in the center of the screen. After hours
    > of trying I couldn't find out how to reach the location properties of an
    > Image WebControl.
    >
    > I'd think there would be some Image.X & Image.Y variables for easy
    > reference but I didn't find any.
    >
    > Any help would be appretiated on this matter.
    >
    > *** Sent via Devdex http://www.devdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Vidar Petursson, Jun 4, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Fi

    repositioning panel inside page

    Paul Fi, Nov 17, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    346
    Paul Fi
    Nov 17, 2004
  2. Neil Greenough

    Repositioning

    Neil Greenough, Aug 29, 2004, in forum: HTML
    Replies:
    11
    Views:
    752
  3. pete

    Repositioning controls on a web page

    pete, Jul 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    115
    Alvin Bruney
    Jul 30, 2003
  4. Hein de Ruyter

    Repositioning HTML-table after post

    Hein de Ruyter, Aug 31, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    493
    Steven Cheng[MSFT]
    Sep 2, 2005
  5. Lee

    problem repositioning control at runtime (c#)

    Lee, Jun 28, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    124
Loading...

Share This Page