Full CSS3 Lightbox - Absolutely no JavaScript
playground.deaxon.com
playground.deaxon.com
For example, a lightbox that fades when you scroll the page might be less invasive.
This CSS-based lightbox actually looks like the first good Lightbox I've seen, in terms of usability.
Being able to produce such a window in web applications could be useful in many situations - we don't need to limit them to image display.
The fact that 'lightboxes' have been abused / over-used, isn't a reason to dismiss the technology.
Kind of like Flash :)
I use few "web 2.0" sites. If I need it, I turn it on per-site.
I assume this isnt some bug or some flaw, and that it can probably be coded to behave differently, but as things stand that would prevent me from using this particular lightbox.
http://playground.deaxon.com/css/lightbox/#pic3
That's a permalink to an individual lightboxed photo. No JS, no server-side magic. Colour me very impressed.
That said, it's a lot cooler and more robust for site owners who might be looking to provide linkers with a little more context than serving a standalone image.
- my grandma, who has a scroll wheel in the middle of her mouse
If she can use a computer and browse the web, she can learn to use the mouse she owns.
[Note: props to your grandma]
Edit: Wait, maybe you're referring to a mouse that has the wheel but the wheel isn't a button? In that case, the GP could have said "right click, open image" rather than "middle click". Same thing.
Most of them use the right click drop down option.
"And have you seen my medication?"
Similarly, if you enable a lightbox and your page goes behind a modal image, hitting back will behave exactly the way it should, i.e. take you back to your previous state.
I'll go one step further and say that a lightbox implementation that doesn't do this should be considered broken since it breaks user expectations. This does raise the question of judging a user's intent when he presses the back/forward button while there is something modal on his screen, but let's save that for some other time.
1) Open the demo page
2) Click image
3) Click 'X' in top left of image
4) Click different image
5) Click the 'X' in the top left of image
6) Click browser's 'back' button
7) Observe how you're staring at the image, not the hacker news page you came from.
The problem is that clicking the 'X' should pop the image off the stack, not just add another page ("#home") to the stack.Opening an image then hitting back works as it should, though.
Consider if this was done just HTML 4 and no CSS or Javascript. You would click a thumbnail and a new page would be loaded with a full size version of the image. You would then click a "close" button that would take you to the page with the thumbnails again. If you hit "back" you would go back to the image.
The way the page currently works follows the "stack" of what I actually visited by clicking links. If I want to reverse my workflow after visiting all 5 images and closing between them, I personally would expect the back button to go through all 5 images. From this perspective, doing the same effect with Javascript that doesn't update the stack might surprise me if after clicking 10 links on this page, a single click of the browser back button skips 10 steps of my workflow and returns me to HN.
The user clicks the image in order to see it full-size. The lightbox overlays the page that the user is on. The user is not conscious that they are navigating to a new page, or even just a part of the page that they weren't at before (to the #image). Though the workflow is in actuality following a link, the user is not aware that they are following a link, so the back button functionality doesn't work as expected.
Links are well understood by everybody that uses the Web. They change the page that you're on to a new page, or a new part of the page. Lightboxes were invented so that the user doesn't need to leave the page, or the part of the page, that they are on.
So in my mind, lightboxes that don't behave like lightboxes and instead behave like links are broken.
1. Go to http://en.wikipedia.org/wiki/Hacker
2. Click the "Innovation" link in the ToC on the right
3. Click the "Entertainment" link (you can just see it) under the "Innovation" one.
4. Click the back button.
5. Observe how you're not taken back to Hacker News.
Now imagine this is a really long page of FAQs, with a "Return to top" after each question, and the same ToC at the top (something a clueless user probably sees everyday [I know I do on O2's site all the time]). You can see how it begins to look like a browser implementation problem.Maybe the browser should automatically pop all "#<identifier>"s associated with a URL from its history stack if a user reaches the original URL again (via backs or clicking some in-page link, doesn't matter); I don't know. But I honestly consider this a browser implementation problem, not a web developer problem. I think anything we've been doing till now has been to mitigate this and we shouldn't have to.
[We can argue the pureness of the demo after that till the end of time though.]
HTML = Content
CSS = Style / Design
JS = Interaction
Once you start to mix them up you start down a hair path
So, the breakup which you have given does not unequivocally argue for the use of JS.
Major reason: Separation of concerns: CSS is for appearance, Javascript is for behavior. They don't work well trying to do the other's job. This is touched on by the shrinking problem I mentioned above - it's easy to watch more events to make the behavior of Javascript functionality more flexible or more user-friendly, but not so much in CSS.
That said, it's a toy demonstration of transitions; it's cool that the bear dances, even if I wouldn't take him on Dancing with the Stars.
I consider lightbox functionality to be related to the layout of the content, and hence logically a part of CSS rather than javascript. In CSS3 world, I like to use javascript for the tasks not related to the layout: such as making ajax queries, manipulating user inputted data, etc.
Is there a case for relying on javascript for functionality such as lightbox?
As argued elsewhere, lightbox straddles JS and CSS domains.
I was thinking that in CSS3 world, we should have slightly different breakup of responsibilities (subject to resolving performance issues) - HTML = Content - CSS3 = style/design and changes in style/design - JS = interaction other than purely style/design changes
I see that this breakup may lead to confusion in some situations. (Though I still find it more appealing for lightbox example) So, let me make up my mind when I have more experience with CSS3 :-)
Of course, it's horribly, horribly broken in IE. Then again, that goes without saying ;)
}
Similarly, it's easier to optimize CSS rendering than it is to optimize arbitrary JavaScript programs.
- respect my back button [1]
- allow me to click outside the picture or press esc to close the lightbox
- allow middle-click to open the image directly
[1] We can argue about transitions and correct behavior all day, but this implementation is different from other lightboxes I've seen, and thus it is "broken" to me.Word. I always make my lightboxes to close on ESC. I hate when I'm forced to click some tiny random-located icon.
I suspect it's a classical case of "you're not your user".
I personally think it's really annoying for the technically literate, and really confusing for the rest of the population.
What I really love, is the chrome plugin that zooms facebook photos on hovering them; facebook photo zoom[1]
[1]: https://chrome.google.com/extensions/detail/elioihkkcdgakfba...
Seems like a lot of people have missed the point that this is just a hack to see if a light box in JUST CSS and HTML could be made. Because theres no JS or actual logic, this demo just leverages the browser to maintain the state. It's a necessary side effect that the back buttons behave this way, and it could be coded to behave differently, but that would defeat the purpose of the exercise.
css: a.lb:target {display:block; text-align:center;} a.lb {display:none;}
html: <a href="#img">show image</a> <a class="lb" href="#" id="img"><img src="image.jpg"></a>
Also, is there any documentation/github repos?
- Works without transactions in Firefox
- Does not work in Internet Explorer 6, 7, or 8.
Enough said (unfortunately).
I especially like his Custom Checkboxes: http://playground.deaxon.com/js/custom-checkboxes/
- 2nd UL list is opacity:0 - :target psuedoclass applies to element whose id is in the url - targeted element has opacity:1
The unseen: Clicking an image kind of works, thanks to the anchors. The browser will scroll down to that image, just like the TOC links on Wikipedia articles.