Changeset - e3a8c4bd708d
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 5 months ago 2023-11-22 11:17:59
ben@sturm.com.au
Fix the sustainer page expanding sections when no URL fragment provided
1 file changed with 13 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -162,6 +162,18 @@ $(document).ready(function() {
 
        var $ourexpandablesection = $(this);
 
        $expandlink.on('click', function(event) {
 
            $expandlink.fadeOut('slow');
 
            $ourexpandablesection.find('.read-more').each(function(index) { $(this).click(); }); });
 
            $ourexpandablesection.find('.read-more').each(function(index) { $(this).click(); });
 
            // Don't laugh. I'm running this twice because the expandable
 
            // sections are hidden by actually their text from the DOM and
 
            // storing it in a closure, to be reinstated later. That means when
 
            // the above ".find('.read-more')" runs it only finds the one
 
            // top-level .read-more element because the children have been
 
            // temporarily removed from the page. After this top-level element
 
            // has been clicked to restore it's body, we can run this again and
 
            // .find() the children elements. I suspect this may have worked in
 
            // the past if there were multiple sections all at the top-level,
 
            // rather than being nested under "Our Year in Review".
 
            $ourexpandablesection.find('.read-more').each(function(index) { $(this).click(); });
 
        });
 
    });
 
});
0 comments (0 inline, 0 general)