252 points · by js4all · 16y ago · 109 comments
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.
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.
[We can argue the pureness of the demo after that till the end of time though.]
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 :-)
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.
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.
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.