简体   繁体   English

当div结束时,jQuery Animate无法正常工作

[英]Jquery Animate Not Working when div is over it

I have a list of images I am trying to animate: 我有要制作动画的图像列表:

<div id = "photoHolderSolutions" class = "PhotoHolder">
    <ul id = "solutionsPhotoList" class = "PhotoList">
    </ul>
</div>

With this CSS: 使用此CSS:

/*
 * Div containing the list of photos
 */
.PhotoHolder
{
    position: absolute;
    top: 559px;
    left: 57px;
    float: left;
    height: 70px;
}

    /*
     * List of photos for each video
     */
    .PhotoList     
    { 
        height: 70px;
        margin: 0px;
        padding: 0;
    }

        .PhotoList li
        {
            list-style-type: none;
            float: left;
            margin: 0 5px 0 5px;
        }

The list items are created through Javascript and the animation works fine. 列表项是通过Javascript创建的,动画效果很好。 I also set all width values ( .PhotoHolder and .PhotoList ) through javascript to be the width of all the images.I want to hide the extra items that are going to be animated to. 我还通过javascript将所有width值( .PhotoHolder.PhotoList )设置为所有图像的宽度。我想隐藏将要动画化的多余项目。 So I did this: 所以我这样做:

    <div id = "topPhotoWindowSolutions" class = "TopPhotoWindow">
        <div id = "photoHolderSolutions" class = "PhotoHolder">
            <ul id = "solutionsPhotoList" class = "PhotoList">
            </ul>
        </div>
    </div>

.TopPhotoWindow
{
    position: absolute;
    top: 559px;
    left: 57px;
    float: left;
    height: 70px;
    width: 420px;
    overflow: hidden;
}

Assuming that TopPhotoWindow would be the container that will hold all the images, and using set height width and overflow: hidden would make only the images I wanted to show up while the lower div .PhotoList scrolled through. 假设TopPhotoWindow将是容纳所有图像的容器,并使用设置的height widthoverflow: hidden将使我想显示的图像在较低的div .PhotoList滚动通过时显示。

Instead what happens is (depending on how I try to work the css) A) All animations stop, and nothing happens (it goes through the method correctly but doesnt move) or B) (happens with this css example) all images disappear) 取而代之的是发生(取决于我如何处理CSS)A)所有动画都停止了,并且什么也没有发生(它正确地通过了方法但没有移动)或B)(发生了这个CSS示例)所有图像消失了)

Suggestions? 有什么建议吗?

.TopPhotoWindow is ALREADY placed at top: 559px and left: 57px .TopPhotoWindow已放置在top: 559pxleft: 57px

Remember .PhotoHolder is INSIDE of .TopPhotoWindow 记住.PhotoHolder是内部.TopPhotoWindow

since .TopPhotoWindow height is 70px, setting .PhotoHolder top to 559px means its outside of the .TopPhotoWindow div... which is overflow:hidden , so that's why its not showing up. 由于.TopPhotoWindow高度为70px,因此将.PhotoHolder top设置为559px意味着其位于.TopPhotoWindow div之外...这是overflow:hidden ,所以这就是为什么它不显示出来的原因。

Suggestions: 意见建议:

  • change position to relative on .PhotoHolder 将位置更改为.PhotoHolder上的相对位置
  • Try modifying CSS of .PhotoHolder .PhotoList without using TopPhotoWindow HTML/CSS 尝试在不使用TopPhotoWindow HTML / CSS的情况下修改.PhotoHolder .PhotoList的CSS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM