PDA

View Full Version : Null/Undefined error when pagination image markup removed



tomb
08-15-2012, 09:18 PM
1) Script Title:
Stepcarousel

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm

3) Describe problem:

When I remove the pagination images from the markup for the stepcarousel (similar to Demo #2 on the main script page), this error is thrown:
"TypeError: config.pageinfo.$controls.eq(0).attr("src", config.pageinfo.srcs[0]) is undefined"

When I replace the pagination markup, the error disappears. My current fix is to apply 'display:none' to hide the code:
<div class="paginate status paging_full_numbers group-tools">
<p class="news-image"></p>
<p id="group-news-paginate">
<a href="javascript:stepcarousel.stepBy('group-news', -1)" class="previous paginate_button">&lsaquo;</a>
<span style="display: none;">
<img src="/images/opencircle.png" data-over="/images/graycircle.png" data-select="/images/closedcircle.png" data-moveby="1" />
</span>
<a href="javascript:stepcarousel.stepBy('group-news', 1)" class="next paginate_button">&rsaquo;</a>
</p>
</div><!--/group-tools-->

What is the proper way to disable/remove the pagination images without throwing an error?

Best Regards,
tom

tomb
08-15-2012, 09:45 PM
I found the problem. I had a div which contained "-paginate" in the id (id="group-news-paginate").

Because "-paginate" existed in the id, this config setting was defined:
config.$paginatediv=$('#'+config.galleryid+'-paginate') //get pagination DIV (if defined)

And because it was defined, quite a few conditionals evaluated to true:
if (config.$paginatediv.length==1){...

Changing the id name fixed my issue.

I hope this helps someone else who may run into this issue.