Changeset - 8ca60f8b076f
[Not reviewed]
0 1 0
Brett Smith (brett) - 3 years ago 2020-11-25 16:43:57
brett@sfconservancy.org
js: Bugfix handling the "no window.location.hash" case.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -90,42 +90,42 @@ $(document).ready(function() {
 
                event.preventDefault();
 
            }
 
        });
 
    });
 

	
 
    var selectSupportType = function(event) {
 
        var $selectedLink = $(event.target);
 
        $(".supporter-type-selector a").removeClass("supporter-type-selector-selected");
 
        $selectedLink.addClass("supporter-type-selector-selected");
 
        $(".supporter-type-selection").hide();
 
        $(event.target.hash).show();
 
        $formCorrectionNeeded.addClass('hidden');
 
        return false;
 
    };
 
    $(".supporter-type-selector a").bind("click", selectSupportType);
 

	
 
    var selectSupportTypeFromHash = function() {
 
        return supportTypeSelector(window.location.hash).click();
 
    };
 
    $window.bind("hashchange", selectSupportTypeFromHash);
 
    if (selectSupportTypeFromHash().length === 0) {
 
        supportTypeSelector("#annual").click();
 
    }
 

	
 
    var want_id = window.location.hash.substr(1);
 
    var want_id = window.location.hash.substr(1) || "do not match any id";
 
    $('a.read-more').each(function(index, readmore) {
 
        var $readmore = $(readmore)
 
        var $content = $(readmore.hash);
 
        var $header = $content.prev('h3');
 
        if (($header.length && $header[0].id === want_id) || readmore.id === want_id) {
 
            $readmore.hide();
 
        } else {
 
            $content.hide();
 
            $readmore.on('click', function(event) {
 
                $readmore.fadeOut('fast', function() {
 
                    $readmore.replaceWith($content);
 
                    $content.fadeIn('fast');
 
                });
 
            });
 
        }
 
    });
 
});
0 comments (0 inline, 0 general)