HTML
  Home arrow HTML arrow Page 4 - Maximizing and Restoring HTML Images: Laye...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Maximizing and Restoring HTML Images: Layer Method
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-11-04

    Table of Contents:
  • Maximizing and Restoring HTML Images: Layer Method
  • The Method
  • Operation
  • Other Image Types

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Maximizing and Restoring HTML Images: Layer Method - Other Image Types


    (Page 4 of 4 )

    I have used a JPEG image just to avoid an unnecessary debugging problem; this is to ensure that the code I have given in this article will work, if you try it. You can use any type of image accepted by browsers in your other projects.

    Image Resolution

    You might have noticed in the past that when you increase the size (dimensions) of an image from the original size taken from the scanner, its resolution (fineness) is lost. However, when you reduce the size (dimensions) of an image its resolution is not lost.

    The solution is this: let the original size taken from your scanner (or digital camera) be the largest size that you can have on your web page. Let this be the size that will be downloaded onto you web page. What we call the normal size of the main image above will simply be a result of the values we force for the image in the style sheet properties. The maximized size should not be greater than the actual size obtained from the scanner.

    Side Effect

    When the image is maximized, its position may change a bit (vertically downwards). This is a side effect, but it is not very bad, since the maximized image will cover elements anyway. Also, the user clicks the image when he wants to maximize the image. When the image is maximized, he concentrates on the image. The slight change in position is therefore not too important.

    However, there is a possible solution for this.

    Solution to Side-Effect

    Browsers today do not handle the CSS “position:absolute” property as they should. So any solution you can get is based on experience with different browsers. Our maximized image is in a Table Cell. Giving the Table Cell the attribute and value ‘valign="top"’ would solve the problem.

    Testing

    Copy the code into a text editor. Save the file with the name “max_rest.htm” in a directory. Save the image file in the same directory. Open the HTML file in your browser. Click the image; it maximizes, covering anything (text) it has to cover in order to maximize. Click the maximized image, and the image should be restored.

    Summary:

    • The image to be maximized is given the CSS “position:absolute” property.

    • The image to be maximized should not be given the CSS Left and Right properties.

    • The image to be maximized is given a z-index that is higher than those of its surrounding elements.

    • The dimensions of the image are increased to maximize it.

    • The vertical align property of the parent element, preferably the TD element, should be given a value of “top.”

    • To restore, reverse the third and fourth points above. You may also give the image the CSS “position:relative” property.

    Conclusion

    If you are developing web pages for e-commerce, shopping or some other purpose, you can write code to increase or decrease the size of images. You do not need to know how to develop a particular type of image (eg. JPEG). The code you write is not long. You use JavaScript and CSS to do this. With this little effort, you save money.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Thanks for stopping by to read my article. If you have any comments, questions, or...
       · Hi, This article I would like if it had become with Ajax. I mean that if I have many...
       · Officially Ajax would download text or XML information. Officially Ajax would not...
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek