Sunday 15 August 2010

jquery - jcarousel.jcarousel('visible') delivers wrong number of items -


I use the jcarousel plugin in my project, I use the following function to determine the endorsement of the product slider I

  Reality endorsement: function (element) {var jcarousel = element.find ('.jcarousel'); Var visible objects = jcarousel.jcarousel ('visible'). Length; }  

When I first load the page with the product slider, the value of visible objects 5 (wrong) shows. Now when I make an event on productslider, for example, to change the size of the browser or click on the jcarosel control, visible objects becomes 6, which is correct in the jaccelle element in the plugin how "visible" Set as? Is this an update bug?

This may be related to jcarousel v0.3.4. I was getting a wrong number of items on the page load on the first load. Then when I changed the size of the browser window, it was fixed. The size of the new window was not to affect the layout of the page but probably an event listener had started. Then get points on jcarousel right. My code was run on document preparation.

Then I triggered the window resizing and fixed the problem.

  $ (window). Triggers ('resize');  

I tried to delay the jcarousel activation and it also worked so I'm sticking to this solution.

  setTimeout (function () {activate karcel ();}, 300); Activate the function ($) ($. 'Jacuzzel'). Jaskell (); $ ('.jcarousel-pagination') .on ('jcarouselpagination: active', 'a', function () ($ (this). AddClass ('active');}) .on ('jcarouselpagination: passive', ' A ', function () {$ (this) .removeClass (' active ');}) .jcarouselPagination ();}  

No comments:

Post a Comment