Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2005
    Location
    San Antonio Tx
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    enlarging images

    if i have an image around 100 width and 100 height
    is there a way to click on the image to enlarge without making a new html page, just enlarging it on same page with new window? and if so , can i have the code?

    thnx

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    put this in your head tags of the page with the thumbnails
    Code:
    <script type="text/javascript">
    function largeimg(title,image1,wid,hgt){
    sw=(screen.width-wid)/2;
    sh=(screen.height-hgt)/2;
    newwin=window.open('','newwin','width='+wid+',height='+hgt+',menubars=0,toolbars=0,scrollbars=0,location=0,directories=0,left='+sw+',top='+sh+'');
    newwin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"');
    newwin.document.write('"http://www.w3.org/TR/html4/loose.dtd">');
    newwin.document.write('<html><head><title>'+title+'</title>');
    newwin.document.write('<style type="text/css">');
    newwin.document.write('html,body{margin:0px;padding:0px;}');
    newwin.document.write('</style>');
    newwin.document.write('</head><body>');
    newwin.document.write('<img src="'+image1+'" width="'+wid+'" height="'+hgt+'" alt="">');
    newwin.document.write('</body></html>');
    }
    </script>
    then in your body tags is where you should have the thumbnail, set up your thumbnails like this
    Code:
    <a href="largerimage.jpg" target="_blank" onclick="largeimg('Large Image','largerimage.jpg','400','400');return false"><img src="smallerimage.jpg" style="border:0px;"></a>
    red is the title that you want the popup window to have
    green is the image you want to popup
    magenta is the width you want the larger image to be
    lime is the height you want the larger image to be
    navy is the thumbnail image
    Last edited by _Aerospace_Eng_; 02-28-2005 at 06:56 AM.

  • #3
    New to the CF scene
    Join Date
    Feb 2005
    Location
    San Antonio Tx
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you


  •  

    Posting Permissions

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