jquery gallery 和 HTML 元素来保存信息

发布于 2024-10-07 21:10:49 字数 412 浏览 3 评论 0原文

我正在尝试建造另一个画廊。有很多,但我没有找到真正支持我的需求的人,而且我喜欢学习。

基本上我希望显示图库中的第一张图片(全尺寸)。当我按下导航箭头(假设它位于图像下方)时,我希望显示下一张图片。这没什么奇怪的。

图库应允许使用图像、替代文本集和标题。

但是我想要选择不预加载尚未显示的图像。因此,看起来我不能使用标签女巫,否则可以满足我的所有需求。用以下内容替换 -tag 是不是不好的做法:

<a href="srcforpic.jpg" title="alt text">Caption goes here</a>

然后,Jquery 会解析它并创建某种奇怪的对象,仅当请求该图像时,该对象才可用于构造 img 标签。 (当然也可以存储它

)缺点?

I'm trying to build just another gallery. There is lots of them but I didn't find anyone that actually supported my need, and beside I like to learn.

Basically I want the first picture in my gallery displayed (in full size). When I press the navigation arrow (Let's say it's just below the image) I want the next picture to show. Nothing strange with that.

The gallery should allow the image, an alt-text set and a caption.

However I want the option to NOT pre load the images that has not yet been displayed. Therefore it looks like I cannot use the tag witch otherwise would support all my needs. Would it be bad practice to substitute the -tag with the following:

<a href="srcforpic.jpg" title="alt text">Caption goes here</a>

The Jquery would then parse this and create some kind of freaky object that can be used to construct an img-tag only when the that image is requested. (and stores it of course)

Pros & cons?

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

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

发布评论

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

评论(2

揪着可爱 2024-10-14 21:10:49

几个月(几年?)前我做了一些与你想要的类似的事情。请查看此处
只是一个概念证明,但我想这仍然是一个好的开始。

I did something similar with what you want few months (years?) ago. Take a look here.
Is just a proof of concept, but i guess is still a good start.

梦醒灬来后我 2024-10-14 21:10:49

好吧,如果我是你,如果这样做,我只需在所有图像 SRC 中添加一个“#”(除了正在显示的图像之外),一旦该人移动到下一张图像,就从该图像的 src 中删除 # ,它比你的解决方案更简单、更快

well, if I were you, instead if doing that , I'd just add a "#" to all image SRCs excpet for the one that's being shown, and once the person move to next image, remove # from the src of that image, it's alot simpler and speedier than your solution

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