collectiveaccess / pawtucket2

Pawtucket Improved
GNU General Public License v3.0
82 stars 75 forks source link

Detail Thumbnails Don't Work With > 2 Representations #69

Closed miqrogroove closed 1 year ago

miqrogroove commented 1 year ago

This is the third bug previously described as part of #38

When an object Detail page has more than 2 representations, clicking the thumbnails in a non-sequential order sometimes has one of these undesirable effects:

  1. Sometimes nothing happens (carousel does not scroll).
  2. Sometimes the carousel scrolls but becomes blank (as if HTML is missing).

For the first item above, I have so far determined that the onclick event always runs as expected, but the animateend event does not. I'm experimenting with the scroll method call to find out why it sometimes works and sometimes doesn't. The problem is not totally about thumbnail clicks. If I click on the last thumbnail, then click the arrow for the previous item, the previous item will not scroll by that method either.

To better summarize the behavior:

The carousel will scroll forward to any thumbnail in the sequence, but will fail to scroll to any previous thumbnail unless it was already initialized by a forward scroll.

For the second item above, the carousel is scrolling too far in some situations. It happens most often with objects having a thumbnail with a taller aspect in the last position than in the first position. If the first thumbnail has a taller aspect, then the bug does not happen.

miqrogroove commented 1 year ago

Based on some preliminary testing, it appears the Pawtucket default theme is using the wrong event to perform AJAX loading of the GetMediaInline content. It currently depends on the animateend event, which happens after both the scroll and scrollend events. In effect, if jCarousel is expecting to see content during the scroll, it will not see it. By moving the AJAX code out of the animateend event and over to the scrollend event, the behavior becomes much more predictable.

I am working on a PR for this now.