Lately I've been doing a lot of iPhone web applications. A client wanted to create a portion of their site for the iPhone, and they wanted it to look a very specific way. In order to do this we had to set the view port's maximum-scale and minimum-scale to 1. This gave them the functionality they desired.
However, one aspect of the web application allowed users to view photos. This caused a problem due to the fact that we had disabled the scale so they were not able to zoom in on photos via pinching.
We solved the problem by before and after loading a picture to be view, we executed a javascript function that changed the value of the viewport.
-
function allowZoom()
-
{
-
document.getElementById("viewport").setAttribute('content','device-width = 320, width = 320, minimum-scale = 1, maximum-scale = 10');
-
}
-
-
function disableZoom()
-
{
-
document.getElementById("viewport").setAttribute('content','device-width = 320, width = 320, minimum-scale = 1, maximum-scale = 1');
-
}
Related Posts
- ASP .NET 2.0, GridViews, HyperLinkField, and JavaScript I've found some interesting notes on ASP .NET's GridView, it's limitations and work arounds. For work I was looking for a way to execute JavaScript from clicking a link on a GridView Cell. An example would be to having a list of transactions and wanting to click a link to...
- iPhone App Development Experience I usually don't post frequently about work projects, especially one after another. I apologize to the aggregation blogs I'm subscribed to, please don't think I'm trying to "pimp" my clients websites. However, today we had our iPhone App approved for the App Store in . This app integrates with our...
- Empowering JavaScript Through jQuery Once I discovered jQuery, my life as a web developer changed. There are few libraries, tools, etc. that I can honestly say have completely changed the way I code. In all honesty, jQuery makes the difficult aspects of JavaScript and turns them into a strength. I recommend it over any...
- iPhone SDK 2.1 - Another NDA Until Apple change's their attitude and policies, they will never be a Microsoft, Sun, or other monolithic technology company. Why? Their NDA on the new iPhone SDK 2.1 hinders developers seriously. They are so tight lipped about everything and are such control freaks that they will never replace Microsoft. If...
- Two-Way Sync between Google Calendar, Windows, OS X, and iPhone Since my wife and I got our new iPhones, I've been playing around with a way unify our calendars. When we first got married we started to use Google Calendar. We have three calendars: mine, hers, and ours. Its great for staying organized, especially when we're trying to organize two...

I am impressed by people who are good in Java. I has just begun to work with it.