News for hackers. Stuff that matters.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by apike on Friday September 06, 2013 @02:32PM (#6341904)
This makes a nice demo and highlights that in some ways, iOS 7 is easier to reproduce using web technology than iOS 6 was.

> There’s been a lot of controversy recently on whether Javascript could compete with native or not, both in terms of performance and of look’n’feel.

On the other hand, the controversially difficult to reproduce parts of iOS 7 aren't part of this demo. The real-time blur, the zooming "z-axis" navigation, the 3D animations, and the 60fps scrubbable gestures for going back in the navigation stack aren't here.

While those are all "bonus effects," they're also a lot of what makes iOS 7 delightful to use.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @08:08PM (#6343348)
Actually, I don't think JS can really compete with native, that's not the point I'm trying to make in this article. Nonetheless, webapps can be an acceptable tradeoff for small apps, that are not too resource-intensive. In such cases, I think HTML, CSS and JS can give good enough results.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by SiVal on Saturday September 07, 2013 @04:04AM (#6344320)
Since iOS6 and iOS7 have different looks and feels, it is apparent that rigidly adhering to the one true native look and feel isn't mandatory. I'll bet HTML5 can get closer to either iOS version than they are to each other and so close that I, an iPhone user, wouldn't notice the difference for the kind of app that doesn't require native hardware access. I'll bet that someone will produce an HTML5 mobile UI that I'll like more than I'll like iOS7. I'll bet that this won't be the last iOS UI overhaul, and that some future Apple TV will have yet another "native look and feel" and that iPhone owners will use their TVs and Kindles and smart refrigerators and countless Web apps and eventually lose track of what "the native look and feel of an iPhone" looks and feels like.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by brianshaler on Saturday September 07, 2013 @12:52AM (#6344015)
(First, nice work!)

I think there's an argument either way on this, though. Even with a simple app, some would say looking very similar to native but being 1% off can be more detrimental to the experience than executing very well on a different, more HTML/CSS/JS-friendly approach.

That being said, I think this would be an interesting thing to start seeing around the web!

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by untog on Friday September 06, 2013 @09:16PM (#6343552)
The z-axis stuff is possible. It's surprisingly how performant CSS3 3D stuff can be, but it's also difficult to do without going overboard.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by jeena on Friday September 06, 2013 @12:13PM (#6341149)
Why don't they use proper HTML5 instead of this tag soup?

https://gist.github.com/jeena/f62232da7d6ac964d403

The rest is a matter of CSS.

[Edit:] moved the code to a gist

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @12:55PM (#6341370)
You're entirely right. I'm just used to the old way, but I guess I'm a bit of an eccentric. I'll try to update the repo asap. (Anyway, I think the HTML architecture could be streamlined, my point was more to demonstrate the css possibilities)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by jeena on Friday September 06, 2013 @01:10PM (#6341460)
And you did a really great job with the CSS. But I know that many young people who are starting with HTML/CSS will be hugely impressed by your examples and will try to copy them. And because they see the div-soup in your examples they will assume that this is how you're supposed to write modern HTML. In the end they see the most modern look in the examples, so I wouldn't even blame them for thinking like that.

It would be sad if they learned to write non-semantic HTML and I think we all who write examples on the net should try to write great examples :)

And in fact we should do it with all the HTML which is online because we all learned HTML and CSS from right click "View Page Source" :D

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by tuxracer on Friday September 06, 2013 @04:18PM (#6342436)
Note that opinions differ on this. Personally I think semantic HTML is nothing but meeting-bait. If you try to be diligent about it you end up in discussions and meetings around whether a certain element should be a figcaption tag should be used or aside etc... And at the end of these types of discussions, regardless of the outcome, nothing that has any actual effect has been changed. It will make zero practical difference whether you use semantic HTML or not. The only thing seemingly affected are imaginary mobile devices that render <nav> differently than <div> or imaginary screen readers that can't read text unless it's in a <figcaption> tag.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by jeena on Saturday September 07, 2013 @04:12AM (#6344348)
It kind of sounds like saying: "Why should I learn math, I will never use it anyway." It might be true, but that is not a good excuse for not learning it. And it is not like using semantic HTML is in any way more work or something, it at least has the benefit of being easier to read and thus maintain.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by tuxracer on Sunday September 08, 2013 @07:34PM (#6350988)
That's very different. Because there are circumstances where not knowing or applying math is a barrier to accomplishing something. Saying "Why should I learn math, I will never use it anyway." means you're banking on the odds that you will never run into those circumstances.

However when it comes to semantic HTML there is no circumstance where you are unable to move forward because you used <div> instead of <figcaption>.

In fact thanks to the sometimes ambiguous descriptions of which semantic tag is appropriate you may find you used the wrong semantic tag which is arguably worse than not using a semantic tag at all.

And at the end of the day after carefully cross referencing and/or memorizing which semantic tag to use throughout your markup zero real world, practical effect has been gained. Only theoretical gains and memorization for memorization's sake.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by jeena on Monday September 09, 2013 @11:09AM (#6353925)
It sounds like to be save one should only use <div> and <span> tags, style them with CSS and forget about semantics?

It is obvious to me that this is the wrong approach. And I have never said he should use <figcaption> I said he should use appropriate HTML5 tags. If something is obviously a header, use <header> if not, don't. But building everything out of <div>s like it was in his first example code is just making it more difficult to read, there is no gain in just using <div> for everything.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by tuxracer on Wednesday September 11, 2013 @01:12PM (#6368424)
"It sounds like to be save one should only use <div> and <span> tags, style them with CSS and forget about semantics?"

Yeah exactly.

"It is obvious to me that this is the wrong approach."

Semantic HTML essentially boils down to "You should because you should."

"I said he should use appropriate HTML5 tags."

To what practical benefit aside from personal aesthetic preference?

"there is no gain in just using <div> for everything"

The gain is not having to memorize or reference which semantic tag goes where, nor having to go back and refactor or maintain semantic tags.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Saturday September 07, 2013 @07:45AM (#6344774)
The code is just cleaner with HTML5 markup. I've updated the project, it's more readable this way :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @01:42PM (#6341635)
You're 100% right. I don't have enough time to do that this evening (it's 8pm in France), so I'll give it a look tomorrow :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by jeena on Friday September 06, 2013 @01:32PM (#6341578)
btw. I wonder if this would also work as smooth as it does now in webkit, when you would add all the -moz- to it and then test it on a Firefox OS phone.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @01:45PM (#6341656)
Mmmh, I'd love to hear a feedback if someone does that. I don't have a firefox OS phone, so I can't tell, but I tested it on an iPhone 4 with iOS 7 beta 6 and I think it's a limit. Of course iOS 7 is not the lightest system on earth but even on more optimized OS like iOS 6, I think the weakest hardware will struggle to process it correctly.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by SunboX on Friday September 06, 2013 @04:29PM (#6342499)
I'm owning a geeksphone keon. Will try this tomorrow. :o)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @07:54PM (#6343302)
Great! I'll be happy to know how it works :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by SunboX on Saturday September 07, 2013 @05:53AM (#6344569)
Works now on FFOS, see:

http://youtu.be/2Bhy2wvwDoU

Runs smooth, comparable with Firefox Desktop Browser. But the scrollMask doesn't fade nicely and I have no clue why this happens. You can reproduce it using regular Firefox Browser (use Tools > Web Developer > Responsive Design View).

Changes on github: https://github.com/c2prods/Project-Tyson/pull/4

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by SunboX on Friday September 06, 2013 @11:59AM (#6341067)
https://beta.icloud.com uses new "iOS7" layout, too. Some styles could be taken from there ;)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @12:42PM (#6341308)
There's a lot of interesting things indeed! They achieve a nice blur effect, even though I suppose it would be way too heave for mobile.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by turval on Saturday September 07, 2013 @01:36AM (#6344085)
If you inspect the page It appears they are generating a blurred version of the png on the fly in js. The source of the blurred version of the image is equal to "data:image/png;base64,iVBOR…7WkYklgQdZAAAAABJRU5ErkJggg==" while the none blurred version is https://beta.icloud.com/system/cloudos/1SBeta.102619/en-us/s...
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by maguay on Friday September 06, 2013 @12:30PM (#6341251)
That is awesome.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by flying_d on Friday September 06, 2013 @02:13PM (#6341793)
Check out http://www.appgyver.com/steroids It's still in it's early stages but looks very promising. It gives you native navigation and transitions, amongst other many other goodies.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @08:03PM (#6343334)
Interesting indeed!
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by alexfringes on Friday September 06, 2013 @09:32AM (#6340309)
Nice attention to detail in this. By the way, it seems like the new view's shadow in the original actually loses opacity as that view leaves the screen. Did you look around for the blur effect at all? You mentioned it but any luck beyond that? I've seen some attempts but nothing useful.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by madeofpalk on Friday September 06, 2013 @10:31AM (#6340598)
Yeah, the iOS 7 'frosted glass translucency is impossible to achieve with CSS. Everyone points to filter: blur(), but that only blurs the element, and not items behind it.

The only thing I could come up with was using something like HTML2Canvas[1] to render a portion of the DOM in a canvas/image, position that exactly on top, and then blur that. But all that seems quite convoluted and heavy, so decided not to invest any energy into it.

[1]: https://github.com/niklasvh/html2canvas

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by meerita on Friday September 06, 2013 @10:56AM (#6340741)
You can blur everything, you just need to point the elements.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by M4v3R on Friday September 06, 2013 @09:40AM (#6340348)
I've looked into this as well. At the moment it is impossible to achieve this effect in plain HTML/Javascript/CSS. It would probably need some Canvas/WebGL magic to work for live content below the navigation bar, but that feels like overdoing it. Achieving blur in CSS is possible, but it's different - you apply blur to an element itself, not to a background of element that covers it.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by yesimahuman on Friday September 06, 2013 @10:04AM (#6340453)
This demo comes close (only works on the phone, and make sure to swipe up to see the menu): http://dl.dropboxusercontent.com/u/2220075/ios7/lax.html

I forget where this comes from, I just have the link.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @10:11AM (#6340491)
Yes, I've seen it an a few others demos. But the difficulty here is to make the content blurred while it scrolls. It's extremely smooth on iOS 7 beta and I can't see anyway to reproduce properly in HTML without severely compromising the performances.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by peterhunt on Friday September 06, 2013 @11:50AM (#6341018)
I think this is actually possible if you use synthetic scrolling (i.e. interpret touch events, compute intertia and use translate3d + requestAnimationFrame). You'd basically have 2 copies of the content area, one blurred w/ css and one not blurred. Render the blurred one above the non blurred one and scroll them in lock step.

You can probably get ok performance if you don't have a lot of images.

A high quality implementation of synthetic scrolling is available at http://github.com/zynga/scroller if you want to play with it.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @11:57AM (#6341062)
Hmm, I've tried something like that (although not as elaborate), but it really was sluggish... It may work but I think you should at least need an iPhone 4S or 5.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by M4v3R on Friday September 06, 2013 @10:42AM (#6340660)
As I said, it's hard/close to impossible to reliably achieve this effect for live content. With static content you can use CSS filters to do the blurring.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by dm2 on Friday September 06, 2013 @10:49AM (#6340702)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by yesimahuman on Friday September 06, 2013 @09:38AM (#6340334)
Fantastic post, thanks for sharing! I'm invested pretty heavily in HTML5 on mobile and your demo just reassures me this is the future (it feels great!). I hope you don't mind me using some of this stuff for a new project I'm working on.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @10:13AM (#6340504)
Thanks! No problem, you can use it for other projects, the code is on github.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by cheeaun on Friday September 06, 2013 @09:49AM (#6340384)
This is a very good job. I plan to iOS7-ify my HackerWeb app once iOS7 is released next month, so your article would be helpful to me :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by josteink on Friday September 06, 2013 @10:28AM (#6340585)
As someone using that app, I would love the option to keep the old interface.

Having web-apps trying to mimick a platform I don't use just feels wrong. In much the same way as those fake Windows-UI images ("Scan complete. 3 viruses found!") used all over the internet trying to trick noobs into installing malware.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by cheeaun on Friday September 06, 2013 @11:00AM (#6340759)
The old interface will stay for older versions of iOS. In fact, I'm already doing that for iOS 6 and iOS 5, which both looks slightly different.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by TazeTSchnitzel on Friday September 06, 2013 @02:58PM (#6342047)
Could you make it possible to use the "wrong" interface? I'd love to try the iOS look on my Android phone
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by cheeaun on Friday September 06, 2013 @08:03PM (#6343332)
You can opt-in to other themes here http://cheeaun.github.io/hackerweb/options.html :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by TazeTSchnitzel on Friday September 06, 2013 @10:34PM (#6343697)
Thanks!
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by SunboX on Friday September 06, 2013 @11:33AM (#6340913)
great news, keep on enhancing hackerweg on all platforms. :D btw, I did few fixes to the iOS7 look&feel: https://github.com/SunboX/Project-Tyson/commits/master
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @12:06PM (#6341109)
Yep, nice changes. I've merged them, thank you!
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by SunboX on Friday September 06, 2013 @01:07PM (#6341441)
n.p. that's open source ;o)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @10:12AM (#6340497)
Thanks! I'll be happy to see a new version of HackerWeb :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by baddox on Friday September 06, 2013 @11:22AM (#6340867)
Have you looked into why your app doesn't go fullscreen in iOS7 Safari currently? The Safari top bar remains.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by cheeaun on Friday September 06, 2013 @11:42AM (#6340970)
I've been on the watch for solutions to fix it. Will dig into it once stable release is out :)
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by chucknelson on Friday September 06, 2013 @10:38AM (#6340641)
Pretty cool. I know this is more of a demonstration of simulating the iOS 7 UI, but I'm assuming to use this for something you'd want the URLs to update as you move through an app?

I may have missed references to this limitation, again, if it even matters for the purpose of the post.

Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @11:53AM (#6341037)
I've actually designed it with a Phonegap integration in mind, to be honest. I think it's possible but you'd probably have to add a great deal of complexity to the code. I'm not familiar with Backbone.js, but may be you can use it to implement routing?
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by solistice on Friday September 06, 2013 @01:54PM (#6341697)
Uhmmm, your live demo just selfdestructed when I clicked on it. Any chance it doesn't work in firefox?
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @08:00PM (#6343323)
I haven't tested it on FF... I really developed it with only iOS in mind, so many CSS properties are prefixed and there might be other bugs...
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by solistice on Sunday September 08, 2013 @09:05AM (#6348579)
Whenever I click on anything it layers the new elements behind the other ones and the whole interface becomes unresponsive. It works for others though, and it's pretty and iOSey, so props on that.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by madeofpalk on Friday September 06, 2013 @10:20AM (#6340540)
Great writeup. I just spent a significant amount of time trying to perfect a CSS UINavigationBar, and still not happy with it
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by quadratini on Friday September 06, 2013 @12:43PM (#6341310)
please properly indent the code snippents
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by c2prods on Friday September 06, 2013 @12:53PM (#6341357)
Ooops, I don't know why it went so wrong, I corrected it.
Re:Cloning the UI of iOS 7 with HTML, CSS and JavaScript by TeeWEE on Friday September 06, 2013 @10:48AM (#6340701)
IOS comes with an (new) UI -> HTML folks clone it -> "Look its cool bro".