【发布时间】:2011-04-30 14:52:04
【问题描述】:
我正在无限轮播上实现 cufon。问题是当 carousel 动态生成下一个循环时, cufon 不会在该循环中显示。有什么解决办法吗?有没有办法在动态生成的文本上实现 cufon?
这里是演示链接
http://hashmatabbas.zxq.net/demo/
点击右键,滚动两次后cufon消失
【问题讨论】:
我正在无限轮播上实现 cufon。问题是当 carousel 动态生成下一个循环时, cufon 不会在该循环中显示。有什么解决办法吗?有没有办法在动态生成的文本上实现 cufon?
这里是演示链接
http://hashmatabbas.zxq.net/demo/
点击右键,滚动两次后cufon消失
【问题讨论】:
尝试使用 Cufon.replace 代替 Cufon.refresh
jQuery(".jcarousel-next, .jcarousel-prev").click(function() {
Cufon.replace(".box_desc h3");
})
【讨论】:
编辑 jquery.jcarousel.js 并添加
Cufon.refresh(".your class here");
在下一个和上一个函数中。
例如,目前在 2011 年 6 月 28 日,我正在使用来自 http://sorgalla.com/jcarousel/ 的版本:0.2.8,您要修改的代码从第 455 行开始,请参见下面的示例:
/**
* Moves the carousel forwards.
*
* @method next
* @return undefined
*/
next: function() {
if (this.tail !== null && !this.inTail) {
this.scrollTail(false);
} else {
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size !== null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
Cufon.refresh(".your class here");
}
},
/**
* Moves the carousel backwards.
*
* @method prev
* @return undefined
*/
prev: function() {
if (this.tail !== null && this.inTail) {
this.scrollTail(true);
} else {
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size !== null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
Cufon.refresh(".your class here");
}
},
【讨论】:
你需要像这样触发Cufon.refresh();:
jQuery(".jcarousel-next, .jcarousel-prev").click(function() {
Cufon.refresh(".box_desc h3");
})
【讨论】: