

comprar viagra online
comprar viagra generico barato
comprar cialis generico online
comprar cialis online seguro
The iPhone unlock screen in xHTML, CSS and jQuery |
The iPhone: Everybody knows what it is, many people "played around" with the gadget and most people love it. I also own one of these amazing smartphones, and the looks of the software is really, really sleek and innovative (Just like we're used from Apple). I wanted to transfer (some) of these amazing designs to a webpage to re-create the same look and feel for webbrowsers. Today, I'm going to show you how to create The iPhone unlock screen in xHTML, CSS and jQuery. ![]() OK, maybe not fully the "feeling" (look and feel) from the iPhone, since I can't make any webbrowser react to placing your finger on the screen, but your mouse will do the trick. Features:
Known issues
Other than those minor issues, it works as expected. I'm planning to make some more of these "iPhone style" webpages, so subscribe to the feed if you want to keep updated. Want to know how I created it? Check it out. Resources Before I started, I needed some reference material to work with.
With all resources set, on to the next step. xHTML When you look in the source of the page, you'll see that the xHTML used isn't very complex. <div id="iphone-scrollcontainer"> <div id="iphone-inside"> <div id="unlock-top"> <p id="timepicker" class="time">08:23</p> <p id="datepicker" class="date">Wednesday, July 6</p> </div> <div id="unlock-spacer"> </div> <div id="unlock-bottom"> <div id="unlock-slider-wrapper"> <div id="unlock-slider"> <div id="unlock-handle"></div> </div> </div> </div> </div> </div>
CSS Now for the CSS part. We're going to use absolute positioning for this since the iPhone container will not resize. I'm only going to explain some things (not all) of the CSS file. #iphone-scrollcontainer { height:461px; width:320px; position:absolute; top:140px; left:40px; background-color:#000000; } #iphone-inside { height:100%; width:100%; background-image:url(../images/background.png); } #unlock-spacer { height:272px; }
JavaScript At this point, we already have a pretty nice interface. For some interaction, we'll need to add some JavaScript. Like I said, I used the 1.2.6 version of jQuery to stay compatible with the Slider component. After including $(document).ready(function() { // Set the slider to be sliding $("#unlock-slider").slider({ handle: "#unlock-handle", animate:true, stop: function(e,ui) { if($("#unlock-handle").position().left == 205) { unlock(); } else { // Should slide back, but can't create it // Reason: When calling "$("#unlock-slider").slider("moveTo", 0);" // a loop is created, causing to crash the page } }}); var unlock = function() { $("#unlock-bottom").fadeOut("normal", function(){ $("#unlock-top").slideUp("fast", function(){ $("#iphone-inside").fadeOut("slow", function(){ window.location="index.html"; }); }); }); } });
All other code should be self-explanatory. Conclusion and Download Looking back, I think this is one pretty cool way of using the jQuery framework. With the sleek interface of the iPhone, what's not to like? Although not exactly everything is the same as the gadget, it still manages to get the iPhone feeling in your webbrowser. That's it! Hoped you learned something new today and start loving the jQuery framework (like I do). Be prepared to expect more jQuery / CSS / xHTML iPhone UI articles in the future. Update Martin provided a fix for the "not sliding back". He also made some adjustments to the code to make it look more like an actual iPhone, like the glowing slider and the same effect. Thanks! I've updated the demo page and download package. Tags: iphone mac screen jquery xhtml css Interested in this topic? You might enjoy another article I've written called |
< Prev | Next > |
---|
Search |
---|
Or try the sitemap |