-->

Cufon Text Disappear in jcarousel

2019-09-06 18:10发布

问题:

Iam implementing cufon on infinite carousel. The problem is that when carousel dynamically generates next loop cufon dont shows there in that loop. Is there any fix? and Is there any way to implement cufon on dynamically generated text?

Here is the Demo link

http://hashmatabbas.zxq.net/demo/

click on right button and after two scrolls the cufon disappears

回答1:

Try to use Cufon.replace instead Cufon.refresh

jQuery(".jcarousel-next, .jcarousel-prev").click(function() {
      Cufon.replace(".box_desc h3"); 
})


回答2:

Edit the jquery.jcarousel.js and add

Cufon.refresh(".your class here");

within the next & previous functions.

So for example, currently on 06/28/11 I'm using Version: 0.2.8 from http://sorgalla.com/jcarousel/ the code you want to modify starts on line 455, see sample below:

/**
* 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");
}
},


回答3:

You need to trigger Cufon.refresh(); like so:

jQuery(".jcarousel-next, .jcarousel-prev").click(function() {
      Cufon.refresh(".box_desc h3"); 
})