Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
getActiveCarouselItemIndex Error..
-
I got this Error in onsen carousel…
Uncaught TypeError: Cannot read property ‘0’ of null
Class.extend._getCarouselItemElements @ onsen.js:7202
Class.extend._getCarouselItemCount @ onsen.js:7327
Class.extend.getActiveCarouselItemIndex @ onsen.js:6916
(anonymous function) @ script.js:661i’m using this function for auto carousel …if i navigate to other pages i got this error repeatedly…
setInterval(function() { var index1 = loginslider.getActiveCarouselItemIndex(); if (index1 >= 4) { loginslider.first(); } else { loginslider.next(); } }, 6000);
-
@ganeshspear The null means it can’t find the element attached to the DOM you are referencing. Either it doesn’t exist (you navigated to a page it is not on and are still calling the function) or you are calling the function to early in the pages creation and the element hasn’t been created yet (use ons.ready()).