对于我的网站设计,我有一个存储内容的
。这些 div 有 2 个。第二个位于第一个之前,借助 z-index:
另外,两个 stuffhere
标签中的内容都是重复的,但有时顶部的图像层stuffhere
被替换为间隔。
我可以用图像来最好地描述这种设置的原因。
更新:(新图片!)
我的代码如何呈现页面http://img5.imageshack.us/img5/8246/ Portfolio4.png
请注意,Casey 网页设计图像 不受条纹背景的影响,而其他块则受到影响。 Casey 网页设计图像是屏幕截图中唯一未被背景着色的元素。
这是因为 back div 内的元素带有条纹背景,而 front div 内的元素则不然。
背面 div 的不透明度为 0.55,带有条纹背景。由于前面的 div 没有背景且不透明度为 1,因此其内容不受条纹背景的影响,因此不会着色。是的,它确实有色调。我可以用另一张图片来说明这一点。
在下面的相同代码快照中,再次向您展示,您将看到某些图像彼此重叠。一个很好的例子是 work_title_heroesforhire.png
和 work_title_heroesforhire-F.png
这是为什么?
下面是没有 F 后缀的图像。
当它放置在背面层时,它会受到不透明度的影响。
下面是带有 F 后缀的图像。
它不受不透明度的影响,因为它放置在前层中。
这就是屏幕截图内的文本没有条纹背景色调的原因。
现在你明白我的设计是如何工作的了,这就是问题所在。当我滚动时,会发生这种情况......
如何同时滚动 2 个 div?有没有办法可以用 javascript 同步 2 个 div 的滚动? jQuery 更可取。
更新
您可以查看的工作示例网页
For my website design, I have a <div class="stuffhere"></div>
where the content is stored. There are 2 of these div's. The second one is in front of the first one, with the help of z-index:
Also the content in both stuffhere
tags are duplicated, but sometimes the images in the top layer stuffhere
is replaced with spacers.
I can describe the reason for this setup best with an image.
Update: (new images!)
how my code renders the page http://img5.imageshack.us/img5/8246/portfolio4.png
Notice how the Casey web design image is not affected by the stripy background, whereas the other blocks are. The Casey web design image is the only element on the screenshot which is not tinted by the background.
This is because elements inside the back div are tinted with the stripey background, whereas elements in the front div are not.
The back div has an opacity of 0.55 with the stripy background. As the front div has no background and has an opacity of 1, its contents are not affected by the stripy background, hence it's not tinted. Yes it does tint. I can illustrate that with another image.
In the same code snapshot below, showing you it again, you will see that for some images overlap each other. A good example of this is the one called work_title_heroesforhire.png
and work_title_heroesforhire-F.png
Why is this?
Below is the image without the F suffix.
It's affected by opacity as it's placed in the back layer.
Below is the image with the F suffix.
It's not affected by opacity as it's placed in the front layer.
This is why the text inside the screenshots does not have a tint of the stripy background.
Now you understand how my design works, here's the problem. When I scroll, this happens...
How can I make 2 div's scroll at the same time? Is there a way I can synchronise the scrolling of 2 div's with javascript? JQuery is preferable.
Update
Working example webpage you can look at
发布评论
评论(1)
下面是一个示例,它将底部 div 动态定位在顶部 div 后面,并且当您滚动顶部 div 时,底部 div 也会动态滚动。
Here is an example that positions the bottom div dynamically behind the top div and as you scroll the top div, the bottom div dynamically scrolls.