jQuery animate(“left”) 在看到全宽之前不显示图像
我正在构建一个非常定制的图像滚动器,它使用 animate("left") 来获得类似选取框的效果,显示一系列带有向左滚动的嵌套图像的
每个 div 将如下所示:
<div class="showcase">
<a href="#" class="showcase">
<img src="images/clients/aria_gray.png" alt="" />
</a>
<img src="images/clients/aria_color.png" width="160" class="scbg" alt="Aria" />
</div>
特定于此代码的 CSS:
div.showcase {
display: inline;
width: /* calculated by a jQuery function */
height: 70px;
position: relative;
float: left;
}
a.showcase img {
position: absolute;
z-index: 1;
}
img.scbg {
position: absolute;
z-index: 0;
}
问题:滚动的图像根本不会显示,直到其完整宽度位于 范围内。 div 角色=“剪辑”>。
我尝试搜索 Google、Blekko、jQuery API 和建议的链接,但我认为我使用了错误的术语来描述我的问题。
我♥堆栈溢出。 :)
I'm building a very tailored image scroller that uses animate("left") to get a marquee-like effect displaying a series of <div>s with nested images scrolling left. They are within a <div role="clip"> with "width: 960px; overflow: hidden;". The images use "position: absolute;" and z-index so that when the user uses mouseover, the gray image on top will fade and reveal the color image.
Each div will look like this:
<div class="showcase">
<a href="#" class="showcase">
<img src="images/clients/aria_gray.png" alt="" />
</a>
<img src="images/clients/aria_color.png" width="160" class="scbg" alt="Aria" />
</div>
The CSS specific to this code:
div.showcase {
display: inline;
width: /* calculated by a jQuery function */
height: 70px;
position: relative;
float: left;
}
a.showcase img {
position: absolute;
z-index: 1;
}
img.scbg {
position: absolute;
z-index: 0;
}
The problem: Images that are scrolling in do not appear at all until their full width is within the <div role="clip">.
I've tried searching Google, Blekko, jQuery API, and the suggested links but I think I'm using the wrong terminology to describe my problem.
I ♥ Stack Overflow. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否能解决您的问题,但您在
div.showcase
选择器中的width
属性后面缺少一个分号。I'm not sure if this will solve your problem or not but you are missing a semicolon after your
width
property in thediv.showcase
selector.