Jquery 图像在淡入淡出时丢失,求助!

发布于 2024-08-17 12:40:47 字数 351 浏览 3 评论 0原文

我最近启动了我的作品集页面,我使用 jquery 插件根据它们的类别对我的作品集条目进行排序。请查看此处

您会注意到,当您将鼠标悬停在每个图像上时,它会放大并显示案例研究链接向上。它应该是这样的。当您按下徽标时,品牌按钮(顶部)它的功能也很完美。 但是,按任何其他按钮,然后滚动图像。它消失了!使该图像恢复的唯一方法是返回到“全部”或“徽标和品牌”部分并翻转丢失的图像。

我似乎无法弄清楚为什么其中一些有效而大多数无效。代码看起来是一致的,但也许我遗漏了一些东西。谢谢。

I Recently launched my portfolio page, and I used a jquery plugin to sort my portfolio entries based on their classes. Please view it Here

You will notice that when you rollover each image, it enlarges and a case study link shows up. That is how it should look. When you press on the logos & branding button (up top) it functions perfectly as well. BUT, press any of the other buttons and then scroll over an image. It disappears! The only way to make that image come back, is to return back to the "all" or "logos & branding" section and rollover the missing image.

I cant seem to figure out why some of it is working and most of it isn't. The code seems to be consistent, but maybe I am missing something. Thanks.

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

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

发布评论

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

评论(1

不离久伴 2024-08-24 12:40:47

发生这种情况是因为您从找到的第一个 .zitem 计算宽度和高度

width = $('.zitem').width() * zoom;
height = $('.zitem').height() * zoom;

当第一个项目被隐藏(由于过滤)时,其显示设置为无,因此其宽度和高度变为 0。

您将需要读取第一个像这样读取高度/宽度时可见的 .zitem

width = $('.zitem:visible').width() * zoom;
height = $('.zitem:visible').height() * zoom;

在取消缩放图像时会执行相同的操作

This happens because you calculate the width and height from the first .zitem you find

width = $('.zitem').width() * zoom;
height = $('.zitem').height() * zoom;

When the first item is hidden (due to the filtering) its display is set to none, so its width and height become 0.

you will need to read the first visible .zitem when reading the height/width like this

width = $('.zitem:visible').width() * zoom;
height = $('.zitem:visible').height() * zoom;

do the same thing when you unzoom the image

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