Problems, need help? Have a tip or advice? Post it here.
24 posts Page 3 of 3
Hi,

Yes, I see the problem now and, I think, I can see what is causing it (it is JavaScript related).
Please give me a little time and I'll get back to you with the solution shortly.

Thanks
Hi Fouridine,

Sorry for the delay.. it has been a busy week.

I have taken the liberty of making some changes to your site. Kindly confirm if the images problem is solved now.

Thanks
Hi thanks for resolving it the last time for me. It seems the problem has arose again for some reason. In addition, clicking on some, the thumbnails appear at the bottom of the first image. For some others, the image does not change with clicking it.

Example in http://www.fouridine.com/work.php?f=9, the first post works well but the other posts on clicking the thumbnails, the main image doesn't change. On the second page, http://www.fouridine.com/work.php?f=9&pg=2, the second post on the page titled ideal backup, clicking the second thumbnail makes it appear under the first image.

Perhaps you could direct me a where has gone wrong in the JS script?
Hi,

Sorry I should have explained the changes I made last time.
You seem to have overwritten the modified files with the older ones.

This is what the problem was -
For each of the 6 images a post had, the original code was generating the ID for the containing DIV as follows (code in list_images.html)
Code: Select all
<div id="photo_<cms:show k_count />" ...

So the IDs for the images went like 'photo_1', 'photo_2' etc.
The JavaScript code (in thumbgallery.js) then identified the images to be hidden/shown based on these IDs.

This worked for single pages (i.e. those that had images for a single item), however for list pages where multiple items were displayed, each with its own set of images, the IDs 'photo_1', 'photo_2' etc. got duplicated (each item's images were given these same IDs).

The fix was to give a unique set of IDs to each item's images. This can be easily done by adding the item's own page_id to each image. The modified code now became-
Code: Select all
<div id="photo_<cms:show k_page_id />_<cms:show k_count />"

This will now generate IDs like 'photo_34_1', 'photo_34_2' for an item with page_id of '34' and 'photo_35_1', 'photo_35_2' for an item with page_id of '35'.

Finally the JavaScript code also needed to be modified to handle the changed IDs. I placed the modified code within a separate js file named 'thumbgallery_ex.js'.
The 'work.php' and 'work_list.html' that called the original js file was modified to additionally link in the new js file.

I have re-applied the changes.
Kindly take a backup of the modified files.
24 posts Page 3 of 3