0

我有这个在图像之间滑动的 JS,但我想将它们更改为淡出 - 更改这些的最佳方法是什么?

这是一个完整的演示,因为它更好:http: //jsfiddle.net/mJcTA/6/

    animate: function () {
            var nextItem, pos;
            // check whether there are enough items to animate to
            if (this.itemIndex > (this.noOfItems - this.options.itemsPerPage)) {
                this.itemIndex = this.noOfItems - this.options.itemsPerPage; // go to last panel - items per transition
            }
            if (this.itemIndex < 0) {
                this.itemIndex = 0; // go to first
            }
            nextItem = this.items.eq(this.itemIndex);
            pos = nextItem.position();

            if (headache) {
                this.runner
.stop()
.animate({ left: -pos.left }, this.options.speed, this.options.easing);
            }
            else {
                this.mask
.stop()
.animate({ scrollLeft: pos.left }, this.options.speed, this.options.easing);
            }
            this.updateBtnStyles();
        }
4

1 回答 1

0

你要改变的是里面的内容

.animate({HERE}..

它将左侧位置 css 属性更改为 0。如果要使其淡入淡出,则正确的动画是将不透明度更改为 1:

.animate({opacity:1}...

请注意, opacity css 属性的解释方式因浏览器而异,因此您可能需要更改多个“不透明度”规则。

代码不完整,因为我没有太多时间阅读整个脚本,但这会让你继续......

于 2012-10-09T13:08:38.073 回答