Chrome and Safari (Webkit engine) add 2 additional <li>
into <ul>
list with class 'jcarousle-item-placeholder'. How can I remove it? jCarousel in FF, IE and Opera is OK.
Thanks for help.
Chrome and Safari (Webkit engine) add 2 additional <li>
into <ul>
list with class 'jcarousle-item-placeholder'. How can I remove it? jCarousel in FF, IE and Opera is OK.
Thanks for help.
I've seen this problem occur in Safari when jcarousel is called twice on the same ul - if you are working with a CMS this can be easy to do as jcarousel could be called by a module function (e.g. jcarousel_add()
with Drupal's jcarousel module), a js file included by your own module code, in a template file etc.
It's worth excluding this as a possibility by commenting out the call you are working with
I found a quick and dirty solution to the problem by adding css "display:none" to any <li>
with the class jcarousel-item-placeholder.
Navigate to your jcarousel.min.js file
Look for (Line 249 for me): if(h.length===0){ h=this.create(e).addClass(this.className("jcarousel-item-placeholder"))
Directly after this with no spaces add: .css({ "display":"none"}).attr("jcarouselindex",c);
Check Chrome, Safari, IE and FF all should work as expected the two empty <li class='...jcarousel-item-placeholder...'></li>
should be gone.
Code section from my jcarousel.min.js:
Line 248...
if(h.length===0){
h=this.create(e).addClass(this.className("jcarousel-item-placeholder"))
//Code to add start
.css({
"display":"none"
}).attr("jcarouselindex",c);
//Code to add end
if(j.length===0)this.list.prepend(h);else j[d?"before":"after"](h);
if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)))
}
j=h;
Make sure your tag has defined height and width attributes like so
<img src="images/test.png" height="100" width="100" alt="test" />
I had similar issues with several 'jcarousel-item-placeholder' classes appearing on list-items, where I did not define width on my tag. I believe the DOM was ready, but the images were not loaded yet as the window onload event had not occurred. Without declaring the width of the image, jcarousel has no way of calculating width correctly until the window is loaded and in that scenario it seems to insert placeholder items.