最小的 jQuery 灯箱脚本

发布于 2024-10-11 12:09:54 字数 103 浏览 1 评论 0 原文

最小的 jQuery 灯箱插件是什么(就大小而言)?类似于 Fancybox,但更小:)

What's the smallest lightbox plugin for jQuery (in terms of size)? Something close to Fancybox, but smaller :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

茶色山野 2024-10-18 12:09:54

我编写了一个名为 Nitelite 的低级 jQuery 灯箱脚本: https://github.com/ premasagar/nitelite (缩小和压缩后为 1.4KB)

它是一种既可以单独使用,也可以构建功能更丰富的灯箱插件的东西。

它已在几个项目的生产中使用:

它是开源的,MIT 许可证。享受 ;)

I wrote a low-level jQuery lightbox script called Nitelite: https://github.com/premasagar/nitelite (it's 1.4KB when minified and gzipped)

It is the kind of thing that can be either used on its own, or to build more feature-rich lightbox plugins.

It's been used in production on a couple of projects:

It's open source, MIT license. Enjoy ;)

狼性发作 2024-10-18 12:09:54

我曾经用过这个...

http://www.digitalia.be/software/slimbox2

只有4K啊

I have used this sometime ...

http://www.digitalia.be/software/slimbox2

It's only 4K .

甲如呢乙后呢 2024-10-18 12:09:54

正如 Yi Jiang 已经说过的,“最小”完全取决于您的具体需求,如果您想要 Fancybox 所做的一切,我几乎不怀疑有一种方法可以使用该插件。

您仍然可以看看其他人,看看它们是否满足您的需求,您应该查看此 lightbox 脚本列表,其中许多脚本的大小比 Fancybox 小,但您仍然需要评估它们并查看它们是否满足您的需求。

最后但并非最不重要的一点是,您始终可以通过阅读 教程。也就是说,如果您想编写自己的。但话又说回来,如果您有这样的特定需求,您应该知道没有人会免费为您编写一些代码。

As Yi Jiang already stated, the "smallest" depends completely on your specific needs, if you want everything that Fancybox does, I hardly doubt that there's a way around using that very plugin.

Still you could take a look at others and see whether they fit your needs, you should check out this list of lightbox scripts, many of which are smaller in size than Fancybox, but you'll still have to evaluate them and see if they fit your needs.

And last but not least you can always write your own one by reading a tutorial. That is, if you want to write your own one. But then again, if you have such specific needs you should know that nobody will come along and write some code for you for free.

何时共饮酒 2024-10-18 12:09:54

我解决这类问题的方法是找到一个满足我的要求的脚本,然后无情地修改它,直到它只包含我需要的内容。一旦实现了这一点,我将缩小脚本(将脚本的压缩留给我的服务器)。

当我们讨论这个主题时,如果您正在寻找主要是为了减少浏览器获取时间的小脚本,那么还要确保您的 Web 服务器缓存控制标头和压缩设置设置为良好的值。您可以在此处找到一篇不错的文章(关于缓存)。如果您没有定义良好的缓存策略,那么如果在每个页面视图上都从服务器下载脚本,那么脚本是否小也没有多大关系。

My approach to these sort of problems is to find a script that meets my requirements then hack it mercilessly until it only contains what I need. Once that's achieved, I'll minify the script (leaving the compression of the script up to my server).

While we're on the subject, if you are looking for small scripts mainly to reduce the browser fetch time, then also ensure that your web server cache control headers and compression settings are set to good values. A nice writeup (regarding caching) can be found here. If you don't have a good caching policy defined, then it won't matter much whether the script is small if it is being downloaded from the server on every page view.

夜巴黎 2024-10-18 12:09:54

我会回避 PrettyPhoto 插件,它看起来很方便。他们的演示中有一则可疑的广告(我的网站在尝试后不久就被重定向了)

如果您正在寻找灯箱,请尝试找到一个已更新为最新查询的灯箱。 Slimbox2 和 fancy box 还没有针对现代 css 进行更新,使用图像来构建盒子,也没有针对最新 jquery 中的简化更改进行更新。

I would shy away from the PrettyPhoto plugin, which appears convenient. There is an advertisement on their demo which is suspicious (my site was redirected shortly after experimenting with it)

If you are looking for a lightbox, try to find one that has been updated to the latest query. Slimbox2 and fancy box have not been updated for modern css, using images to build the box, and neither have been updated for streamlining changes in the latest jquery.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文