TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Full CSS3 Lightbox - Absolutely no JavaScript

252 点作者 js4all超过 14 年前

21 条评论

deaxon超过 14 年前
I've been tweeting this today but I think it could be useful to repeat it here: my CSS demos are only experiments. The goal is to test all those new possibilities, show the power of CSS3 and, basically, having fun. They aren't intended to be used in production and actually you shouldn't. Most of them are not accessible and not cross browser…
评论 #1884351 未加载
评论 #1885372 未加载
aw3c2超过 14 年前
So I will get lightboxed even with my no-javascript browsing habits? I liked that most sites simply serve the direct image url to me. Lightbox is an annoying eye-candy.
评论 #1884356 未加载
评论 #1883935 未加载
评论 #1885880 未加载
评论 #1885695 未加载
评论 #1884086 未加载
krmmalik超过 14 年前
Dont like how when i press the back button i get a history of pictures i have viewed. If i am at liberty to choose whichever picture i want then i dont need the back button to preserve my selection history. When i click back, i want to go BACK to the site i just came from.<p>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.
评论 #1884457 未加载
评论 #1884359 未加载
jluxenberg超过 14 年前
Is it just me or is the Lighbox effect really annoying? What's wrong with middle-clicking an image and having it open in a new tab?
评论 #1883695 未加载
评论 #1883742 未加载
评论 #1884267 未加载
评论 #1883749 未加载
cmer超过 14 年前
Nice! It breaks the back button however...
评论 #1883600 未加载
评论 #1884251 未加载
评论 #1883560 未加载
Semiapies超过 14 年前
Neat that you can do that. Not a technique that I'd ever want to use.
评论 #1883611 未加载
评论 #1883568 未加载
bradlane超过 14 年前
Works great in Chrome; Firefox has a border around each pic, since they're links.<p>Of course, it's horribly, horribly broken in IE. Then again, that goes without saying ;)
评论 #1883718 未加载
krosaen超过 14 年前
Interesting to see this is possible, but this is beyond what I would want to use css for, how far will "look ma! no javascript!" go? Seing the logic in a jquery click handler seems at least as readable / maintainable as a bunch of css rules for the same reason I prefer to have more logic in java in android applications than in various xml layout and manifest files.
评论 #1883869 未加载
评论 #1884057 未加载
IChrisI超过 14 年前
This is pretty cool. Suggestions:<p><pre><code> - 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 </code></pre> [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.
评论 #1885650 未加载
blhack超过 14 年前
Out of curiosity, what is the point of a "light box"? I tend to open lots of images into new tabs while I'm reading articles, and it's <i>really</i> annoying to have the rest of the article go black when I do.
评论 #1884148 未加载
评论 #1884143 未加载
评论 #1884346 未加载
torme超过 14 年前
Very neat, I checked out the other stuff you've got on there and it's pretty sweet.<p>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 <i>could</i> be coded to behave differently, but that would defeat the purpose of the exercise.
TamDenholm超过 14 年前
Works beautifully on the iPad. Very nice work.
dpatru超过 14 年前
It's done by using the :target selector. Targeted images are lightboxed. There is a link in the lightbox that resets the target to dismiss the lightbox. Crudely:<p>css: a.lb:target {display:block; text-align:center;} a.lb {display:none;}<p>html: &#60;a href="#img"&#62;show image&#60;/a&#62; &#60;a class="lb" href="#" id="img"&#62;&#60;img src="image.jpg"&#62;&#60;/a&#62;
EGF超过 14 年前
This is actually quite nice because it allows permalinks to the lightbox items. This makes for a rough browsing experience if you need to go back, but I like the detail that lets you link somewhere that someone can actually find in the future vs. "go to this page, then click here, etc...."
dmix超过 14 年前
Looks great. Does this work cross-browser? (besides the transition effect)<p>Also, is there any documentation/github repos?
评论 #1883699 未加载
评论 #1883575 未加载
评论 #1883673 未加载
评论 #1883581 未加载
unicornhorn超过 14 年前
Does anybody know of a minimalist JS variant? There are so many JS lightbox versions I don't even know where to start. I need something super simple.
bradlane超过 14 年前
If you go up a directory, there are some other neat things in CSS:<p><a href="http://playground.deaxon.com/css/" rel="nofollow">http://playground.deaxon.com/css/</a>
评论 #1883659 未加载
lurchpop超过 14 年前
kind of annoyed me there was no explanation.<p>- 2nd UL list is opacity:0 - :target psuedoclass applies to element whose id is in the url - targeted element has opacity:1
DjDarkman超过 14 年前
The problem is that not all browsers support CSS3.
akivabamberger超过 14 年前
can someone post a screenshot of this in IE6
评论 #1884075 未加载
jon_hendry超过 14 年前
Slow, like all lightbox implementations. And the flash of the background color is likely to give someone a seizure. (Ok, I'm being facetious there, but it looks jerky.)