Assuming that zooming-in bitmapped images with JavaScript may be interesting and useful to you, in this series of tutorials, I’ll develop a highly-expansible client side application, which will be tasked with enlarging (and decreasing when applicable) the dimensions of a specific image.
Zooming in on Images with JavaScript (Page 1 of 4 )
As you may have noticed, more and more modern web sites are incorporating different client and server-side mechanisms aimed at providing visitors with a highly-customized surfing experience. This fact is particularly evident with web sites that deliver their respective contents in diverse formats (the prestigious Developer Shed network is a good example), such as (X)HTML, printer-friendly versions, PDF, etc.
This level of customization is achieved by using a server-side scripting language, which certainly can be useful for delivering database contents in a variety of formats. There are many other approaches that can be implemented via client-side programming to allow users of a given web site to personalize some of its elements.
With reference to the previous concept, it’s common nowadays to see certain web sites that include small controls for decreasing and enlarging the size of their text-based contents, or even panels that allow you to change the complete appearance of different sections of the web site via the direct manipulation of its style sheets.
Of course, as you might guess, the concept surrounding the implementation of diverse mechanisms focused on customizing the surfing experience of users can also be extended to other elements of a web site, such as bitmapped images. In truth, it’s relatively easy to develop a JavaScript application that lets users modify certain aspects of different images on a web page, such as enlarging proportionally their respective width and height values.
Logically, the purpose of doing this is to provide visually impaired visitors with a simple mechanism that allows them to enlarge determined bitmapped images that belong to a particular web site. In addition, the mentioned mechanism can be developed, but all of the JavaScript applications that run on that web site should have a graceful degradation, if scripting has been disabled on the browser, which implies that users will still be able to view the images.
Speaking more specifically, I’m going to start this educational journey by building an introductory zooming script, but in the upcoming parts of the series, I’ll add more complex features to it. So, are you ready to learn how to zoom images in and out with JavaScript? Great, let’s get started now!