1

我正在尝试使用 jquery 简单地滚动插件 t 动画循环无限滚动。我的 Html 大纲如下:

<html>
<head>
<!- title,link,script tags go here... -->
</head>

<body>
<div id="holder" style="position : relative;">
  <div id="slider" style="position : fixed; overflow : hidden; z-index : -1;">
    <ul id="scroller">
      <li><img src="img/1.jpg" /></li>
      <li><img src="img/2.jpg" /></li>
      <li><img src="img/3.jpg" /></li>
      <li><img src="ing/4.jpg" /></li>
    </ul>
  </div>
  <div id="main" style="position : absolute"><!- Holds the page r site contenys --></div>
</div>
</body>

</html>

jquery.simply-scroll.css简单滚动插件 zip 存档提供的默认(未编辑)如下:

/*
 * simplyScroll 2 - a scroll-tastic jQuery plugin
 *
 * http://logicbox.net/jquery/simplyscroll
 *
 * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
 *
 * Dual licensed under the MIT and GPL licenses.
 *
 * Last revised: 31/01/2012
 *
 */

/* Default/Master classes 

Example markup format (for horizontal scroller)
Note all DIVs are generated and should not be hard-coded

<div class="your-custom-class simply-scroll-container">
    <div class="simply-scroll-btn simply-scroll-btn-left"></div>
    <div class="simply-scroll-btn simply-scroll-btn-right"></div>
    <div class="simply-scroll-clip">
        <ul class="simply-scroll-list">
            <li>...</li>
            ...
        </ul>
    </div>
</div>


*/

.simply-scroll-container { /* Container DIV - automatically generated */
    position: relative;
}

    .simply-scroll-clip { /* Clip DIV - automatically generated */
        position: relative;
        overflow: hidden;
    }

    .simply-scroll-list { /* UL/OL/DIV - the element that simplyScroll is inited on */
        overflow: hidden;
        margin: 0;
        padding: 0;
        list-style: none;
    }

        .simply-scroll-list li {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        .simply-scroll-list li img {
            border: none;
            display: block;
        }

    .simply-scroll-btn {
        position: absolute;
        background-image: url(buttons.png);
        width: 42px;
        height: 44px;
        z-index:3;
        cursor: pointer;
    }

    .simply-scroll-btn-left {
        left: 6px;
        bottom: 6px;
        background-position: 0 -44px;
    }
    .simply-scroll-btn-left.disabled {
        background-position: 0 0 !important;
    }
    .simply-scroll-btn-left:hover, .simply-scroll-btn-left:focus {
        background-position: 0 -88px;
    }

    .simply-scroll-btn-right {
        right: 6px;
        bottom: 6px;
        background-position: -84px -44px;
    }
    .simply-scroll-btn-right.disabled {
        background-position: -84px 0 !important;
    }
    .simply-scroll-btn-right:hover, .simply-scroll-btn-right:focus {
        background-position: -84px -88px;
    }

    .simply-scroll-btn-up {
        right: 6px;
        top: 6px;
        background-position: -126px -44px;
    }
    .simply-scroll-btn-up.disabled {
        background-position: -126px 0 !important;
    }
    .simply-scroll-btn-up:hover, .simply-scroll-btn-up:focus {
        background-position: -126px -88px;
    }

    .simply-scroll-btn-down {
        right: 6px;
        bottom: 6px;
        background-position: -42px -44px;
    }
    .simply-scroll-btn-down.disabled {
        background-position: -42px 0 !important;
    }
    .simply-scroll-btn-down:hover, .simply-scroll-btn-down:focus {
        background-position: -42px -88px;
    }

    .simply-scroll-btn-pause {
        right: 6px;
        bottom: 6px;
        background-position: -168px -44px;
    }
    .simply-scroll-btn-pause:hover, .simply-scroll-btn-pause:focus {
        background-position: -168px -88px;
    }

    .simply-scroll-btn-pause.active {
        background-position: -84px -44px;
    }
    .simply-scroll-btn-pause.active:hover, .simply-scroll-btn-pause.active:focus {
        background-position: -84px -88px;
    }

    /* Custom class modifications - override classees

    .simply-scroll is default

    */

    .simply-scroll { /* Customisable base class for style override DIV */
        width: 576px;
        height: 200px;
        margin-bottom: 1em;
    }

        .simply-scroll .simply-scroll-clip {
            width: 576px;
            height: 200px;
        }

            .simply-scroll .simply-scroll-list {}

            .simply-scroll .simply-scroll-list li {
                float: left;
                width: 290px;
                height: 200px;
            }
            .simply-scroll .simply-scroll-list li img {}

        .simply-scroll .simply-scroll-btn {}

        .simply-scroll .simply-scroll-btn-left {}
        .simply-scroll .simply-scroll-btn-left.disabled {}
        .simply-scroll .simply-scroll-btn-left:hover {}

        .simply-scroll .simply-scroll-btn-right {}
        .simply-scroll .simply-scroll-btn-right.disabled {}
        .simply-scroll .simply-scroll-btn-right:hover {}

        .simply-scroll .simply-scroll-btn-up {}
        .simply-scroll .simply-scroll-btn-up.disabled {}
        .simply-scroll .simply-scroll-btn-up:hover {}

        .simply-scroll .simply-scroll-btn-down {}
        .simply-scroll .simply-scroll-btn-down.disabled {}
        .simply-scroll .simply-scroll-btn-down:hover {}



    /* Vertical scroller example */

    .vert { /* wider than clip to position buttons to side */
        width: 340px;
        height: 400px;
        margin-bottom: 1.5em;
    }

        .vert .simply-scroll-clip {
            width: 290px;
            height: 400px;
        }

            .vert .simply-scroll-list {}

            .vert .simply-scroll-list li {
                width: 290px;
                height: 200px;
            }
            .vert .simply-scroll-list li img {}

        .vert .simply-scroll-btn {}

        .vert .simply-scroll-btn-up { /* modified btn pos */
            right: 0;
            top: 0;
        }
        .vert .simply-scroll-btn-up.disabled {}
        .vert .simply-scroll-btn-up:hover {}

        .vert .simply-scroll-btn-down { /* modified btn pos */
            right: 0;
            top: 52px;
        }
        .vert .simply-scroll-btn-down.disabled {}
        .vert .simply-scroll-btn-down:hover {}

        /* NOTE left-right classes wouldn't be needed on vertical scroller */

当链接到 HTML 时,上面的 css 在所有浏览器中的工作方式都相同。滚动效果覆盖背景左上角的 570x200px。但是当我尝试自定义它以占据整个屏幕时,它的行为出乎意料,即它在 IE10 和 Firefox 中可以正常工作,但在 Chrome 中却不行。上述CSS的自定义版本如下:

/*
 * simplyScroll 2 - a scroll-tastic jQuery plugin
 *
 * http://logicbox.net/jquery/simplyscroll
 *
 * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
 *
 * Dual licensed under the MIT and GPL licenses.
 *
 * Last revised: 31/01/2012
 *
 */

/* Default/Master classes 

Example markup format (for horizontal scroller)
Note all DIVs are generated and should not be hard-coded

<div class="your-custom-class simply-scroll-container">
    <div class="simply-scroll-btn simply-scroll-btn-left"></div>
    <div class="simply-scroll-btn simply-scroll-btn-right"></div>
    <div class="simply-scroll-clip">
        <ul class="simply-scroll-list">
            <li>...</li>
            ...
        </ul>
    </div>
</div>


*/

.simply-scroll-container { /* Container DIV - automatically generated */
    position: relative;
}

    .simply-scroll-clip { /* Clip DIV - automatically generated */
        position: relative;
        overflow: hidden;
    }

    .simply-scroll-list { /* UL/OL/DIV - the element that simplyScroll is inited on */
        overflow: hidden;
        margin: 0px;
        padding: 0px;
        list-style: none;
    }

        .simply-scroll-list li {
            padding: 0px;
            margin: 0px;
            list-style: none;
        }

        .simply-scroll-list li img {
            border: none;
            display: block;
        }

    .simply-scroll-btn {
        position: absolute;
        background: url('../img/buttons/buttons.png');
        width: 42px;
        height: 44px;
        z-index:3;
        cursor: pointer;
    }

    .simply-scroll-btn-left {
        left: 6px;
        bottom: 6px;
        background-position: 0 -44px;
    }
    .simply-scroll-btn-left.disabled {
        background-position: 0 0 !important;
    }
    .simply-scroll-btn-left:hover, .simply-scroll-btn-left:focus {
        background-position: 0 -88px;
    }

    .simply-scroll-btn-right {
        right: 6px;
        bottom: 6px;
        background-position: -84px -44px;
    }
    .simply-scroll-btn-right.disabled {
        background-position: -84px 0 !important;
    }
    .simply-scroll-btn-right:hover, .simply-scroll-btn-right:focus {
        background-position: -84px -88px;
    }

    .simply-scroll-btn-up {
        right: 6px;
        top: 6px;
        background-position: -126px -44px;
    }
    .simply-scroll-btn-up.disabled {
        background-position: -126px 0 !important;
    }
    .simply-scroll-btn-up:hover, .simply-scroll-btn-up:focus {
        background-position: -126px -88px;
    }

    .simply-scroll-btn-down {
        right: 6px;
        bottom: 6px;
        background-position: -42px -44px;
    }
    .simply-scroll-btn-down.disabled {
        background-position: -42px 0 !important;
    }
    .simply-scroll-btn-down:hover, .simply-scroll-btn-down:focus {
        background-position: -42px -88px;
    }

    .simply-scroll-btn-pause {
        right: 6px;
        bottom: 6px;
        background-position: -168px -44px;
    }
    .simply-scroll-btn-pause:hover, .simply-scroll-btn-pause:focus {
        background-position: -168px -88px;
    }

    .simply-scroll-btn-pause.active {
        background-position: -84px -44px;
    }
    .simply-scroll-btn-pause.active:hover, .simply-scroll-btn-pause.active:focus {
        background-position: -84px -88px;
    }

/* Custom class modifications - override classees

.simply-scroll is default

*/

.simply-scroll { /* Customisable base class for style override DIV */
    width: inherit;
    height: inherit;
    margin: 0;
}

    .simply-scroll .simply-scroll-clip {
        width: inherit;
        height: inherit;
    }

        .simply-scroll .simply-scroll-list {}

        .simply-scroll .simply-scroll-list li {
            float: left;
/*          height:100%;
            width: auto;
            background: yellow;
*/      }
        .simply-scroll .simply-scroll-list li img {
            height: 100%;
            width: auto;
        }

    .simply-scroll .simply-scroll-btn {}

    .simply-scroll .simply-scroll-btn-left {}
    .simply-scroll .simply-scroll-btn-left.disabled {}
    .simply-scroll .simply-scroll-btn-left:hover {}

    .simply-scroll .simply-scroll-btn-right {}
    .simply-scroll .simply-scroll-btn-right.disabled {}
    .simply-scroll .simply-scroll-btn-right:hover {}

    .simply-scroll .simply-scroll-btn-up {}
    .simply-scroll .simply-scroll-btn-up.disabled {}
    .simply-scroll .simply-scroll-btn-up:hover {}

    .simply-scroll .simply-scroll-btn-down {}
    .simply-scroll .simply-scroll-btn-down.disabled {}
    .simply-scroll .simply-scroll-btn-down:hover {}

请指出相同的问题和解决方案。我的设计链接如下:

 - http://appspot.comyr.com/restaurants_hd/      main site
 - http://appspot.comyr.com/restaurants_hd/js/  Js files
 - http://appspot.comyr.com/restaurants_hd/css/ css files
 - http://appspot.comyr.com/restaurants_hd/img/ image files

在 IE、Firefox、Chrome 中尝试指向主站点的链接,您会发现问题。即使在某些情况下,如果 4 个图像仅显示 1 个或有时 2 个图像而其余图像消失,则滚动也可以工作。

请帮助我进行正确的设置,以便滚动填满整个屏幕(无论屏幕分辨率如何)。

感谢和问候。

4

1 回答 1

1
Go through below jsfiddle.

http://jsfiddle.net/uruwf/3/

希望它会帮助你。

我已经在 IE - 9 及更高版本、Google Chrome 最新版本和 firefox - 31.0 中对其进行了测试。它的工作很好。

于 2014-08-27T07:54:13.770 回答