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

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.

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.

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, the first post works well but the other posts on clicking the thumbnails, the main image doesn't change. On the second page,, 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?

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

Who is online

In total there are 18 users online :: 0 registered, 0 hidden and 18 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 18 guests