Today a customer informed me that Slider wasn’t working properly on his webpage. They gave me the URL to the problem page, and for a page with a working (properly) version of Slider.
Initially I was perplexed, but it dawned on me that the code for parsing out the cell numbers can only parse single-digit numbers.
A classic case of short-sighted programming.
See the cells’ class attribute was put together like this:
cell + the cell’s number + unique ID.
Code for parsing out the cell’s number:
Notice that it only gets one character.
To work correctly, two things needed to be changed.
First, I had to change the way the cells’ class attribute is put together:
cell + unique ID + the cell’s number
parseInt(jQuery(peeker).attr("class").substring(("cell" + length of cell + unique ID),(length of class attribute)))
The updated plugin is available here: Slider 0.95b
I’m confident that I’ve fixed the problem, but if I haven’t don’t hesitate to let me know!
Incidentally, the customer’s website is extremely well done, go and check it out!
I realised that I didnâ€™t want comments to be visible on the page in case one set of photos became wildly popular (yeah, right); which would result in a page of comments with a few photos, instead of a page of photos with maybe one or two comments. For some reason, Greybox popped into my head, and wouldnâ€™t leave. A few hours later, this happened: Hangzhou Day 1.